Note:
echo -n
代表不发送换行符; 不带参数默认发送换行符。
base64 encode
echo -n 123|base64
or
echo -n "123"|base64
or
base64 -i 1.txt
or
echo -n 123|openssl enc -base64
1234567
base64 decode
echo -n MTIz|base64 -D
or
echo -n "MTIz"|base64 -D
or
base64 -D -i 1.txt
or
echo MTIz|openssl enc -base64 -d;echo
or
echo MTIz|openssl enc -base64 -d
123456789
openssl dgst -md5 123.bin
or
openssl md5 123.bin
or
md5 123.bin
or
md5 -s "text"
or
echo -n foo|md5
or
echo -n "foo"|md5
or
echo -n "foo"|openssl dgst -md5
12345678910111213
HmacMD5
openssl md5 -hmac "key" 123.bin
echo -n "value" | openssl dgst -md5 -hmac "key"
12
openssl dgst -sha1 123.bin
or
openssl sha1 123.bin
or
echo -n "value" | openssl dgst -sha1
12345
HMAC_SHA1
echo -n "value" | openssl dgst -sha1 -hmac "key"
echo -n "value" | openssl sha1 -hmac "key"
12
SHA256
openssl sha256 123.bin
or
openssl dgst -sha256 123.bin
or
echo -n "value" | openssl dgst -sha256
12345
HMAC_SHA256
echo -n "value" | openssl dgst -sha256 -hmac "key"
echo -n "value" | openssl sha256 -hmac "key"