Exiting PHP MD5 and Solaris Digest MD5 do not match

When I run the code below in PHP

$saltedPW = "Test12309566173258152148992"; $hashedPW = md5($saltedPW); echo $hashedPW; 

output i get is fc8f7b8737b9d4754ff1156a3ad88b03

when i run the above in bash shell in solaris window

 echo Test12309566173258152148992 | digest -a md5 

output i get is 04df7b4ce498b87d696b32140ca63f6a

Am I doing something wrong guys?

I tried double quotes in the shell and I still get the same result.

+4
source share
1 answer

That, since echo adds a new line by default, you need to add the -n argument:

 echo -n Test12309566173258152148992 | digest -a md5 # fc8f7b8737b9d4754ff1156a3ad88b03 
+6
source

Source: https://habr.com/ru/post/1481087/


All Articles