Today's group asked a question:
Echo 123 | md5sum
Ba1f2511fc30423bdbb183fe33f3dd0f-
Php-R "Echo MD5 ('20140901 ');"
202cb962ac59075b964b07152d234b70
The MD5 values of the two are inconsistent, so there are many interesting solutions:
1 MySQL solution:
Mysql> select MD5 ('20140901 ');
+ ---------------------------------- +
| MD5 ('20140901') |
+ ---------------------------------- +
| 202cb962ac59075b964b07152d234b70 |
+ ---------------------------------- +
2. Modify the linefeed Method
[Root @ fetion ~] # Printf 123 | md5sum
202cb962ac59075b964b07152d234b70-
[Root @ fetion ~] # Echo-n123 | md5sum
202cb962ac59075b964b07152d234b70-
[Root @ fetion ~] # Echo 123 | tr-d' \ n' | md5sum
202cb962ac59075b964b07152d234b70-
Summary:
1 echo ends with line breaks by default
2 echo-N can remove line breaks
3. printf does not end with a line break.
4 Tr can delete a character, such as tr-d' \ n'
5. execute a program in the php Command Line: PHP-R "code"