Shell:
echo -n "MyString" |md5sum/sha1sum |awk '{print $1}'
Mac OS:
md5 -s "MyString" echo -n "MyString" |md5 echo -n "MyString" |shasum |awk '{print $1}'
Python:
import hashlib
md5string = hashlib.md5() # sha1string = hashlib.sha1()
md5string.update("MyString")
print md5string.hexdigest()
PHP:
<?php
$md5string = md5("MyString") ;
$sha1string = sha1("MyString") ;
echo $md5string/$sha1string ;
?>
转载于:https://blog.51cto.com/ouziyou/1716945