04 November 2013

md5 hash : php vs linux bash

Hasil dua hash tak sama.

md5("anakomak")
vs
echo "anakomak" | md5sum

sebab:
echo dalam bash akan tambah extra character (new line)

solution:
echo -e "anakomak\c" | md5sum         <<== baru sama.

man echo:
-e     enable interpretation of backslash escapes
\c     produce no further output

No comments:

Post a Comment

Terima kasih