Why am I getting the same MD5 checksum for seemingly different inputs using Perl's Digest::MD5?

StackOverflow https://stackoverflow.com/questions/3163179

  •  02-10-2019
  •  | 
  •  

Question

On my Linux platform with 64bits recompiled perl and SSHing Mac terminal (I guess UTF-8). I am giving all this information just in case it might be relevant.

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@vi\n") ."\n");'
756e98065cb8cbf603a3dbef2afe9261

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@visi\n") ."\n");'
756e98065cb8cbf603a3dbef2afe9261

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@vision\n") ."\n");'
756e98065cb8cbf603a3dbef2afe9261

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@visionten\n") ."\n");'
756e98065cb8cbf603a3dbef2afe9261

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@visionten.\n") ."\n");'
d32e04de6906b3f284c6834b4d1d77c1

# perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@\n") ."\n");'
264eca1047ccc6272ac2e338c695379e
Was it helpful?

Solution

You are using @ inside a double-quoted string. All of the @vision and @visionten things are evaluating to the same thing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top