sha1、md5、base64
mac
$ echo -n foo|shasum0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 -$ echo -n foo|shasum -a 2562c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae -$ echo -n foo|openssl dgst -sha10beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33$ echo -n foo|openssl dgst -sha2562c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae$ echo -n foo|md5acbd18db4cc2f85cedef654fccc4a4d8$ md5 -s fooMD5 ("foo") = acbd18db4cc2f85cedef654fccc4a4d8$ echo -n foo|openssl dgst -md5acbd18db4cc2f85cedef654fccc4a4d8$ echo -n foo|base64Zm9v$ echo Zm9v|base64 -D;echofoo$ echo -n foo|openssl enc -base64Zm9v$ echo Zm9v|openssl enc -base64 -d;echofoo$ echo -n foo|openssl dgst -md5 -binary|openssl enc -base64rL0Y20zC+Fzt72VPzMSk2A==
openssl命令可以简单写:
openssl sha1openssl sha -sha256openssl md5openssl base64openssl base64 -d
linux
# echo -n foo|shasum0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 -# echo -n foo|shasum -a 2562c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae -# echo -n foo|openssl dgst -sha1(stdin)= 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33# echo -n foo|openssl dgst -sha256(stdin)= 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae# echo -n foo|md5sumacbd18db4cc2f85cedef654fccc4a4d8 -# echo -n foo|openssl dgst -md5(stdin)= acbd18db4cc2f85cedef654fccc4a4d8# echo -n foo|base64Zm9v# echo Zm9v|base64 -d;echofoo# echo -n foo|openssl enc -base64Zm9v# echo Zm9v|openssl enc -base64 -d;echofoo# echo -n foo|openssl dgst -md5 -binary|openssl enc -base64rL0Y20zC+Fzt72VPzMSk2A==
openssl命令可以简单写:
openssl sha1openssl sha256openssl sha sha256openssl md5openssl base64openssl base64 -d
urlencode/urldecode[1]
$ alias urldecode='python -c "import sys, urllib as ul; \ print ul.unquote_plus(sys.argv[1])"'$ alias urlencode='python -c "import sys, urllib as ul; \ print ul.quote_plus(sys.argv[1])"'$ urlencode 'lalala啦啦啦'lalala%E5%95%A6%E5%95%A6%E5%95%A6$ urldecode 'alala%E5%95%A6%E5%95%A6%E5%95%A6'alala啦啦啦
可以将alias个语句放到.bashrc或者其他shell的启动rc文件里(如:.zshrc),用source载入。
已安装的shell和当前shell:
$ cat /etc/shells# List of acceptable shells for chpass(1).# Ftpd will not allow users to connect who are not using# one of these shells./bin/bash/bin/csh/bin/ksh/bin/sh/bin/tcsh/bin/zsh$ echo $0-/bin/zsh$ echo $SHELL/bin/zsh$ env|grep SHELLSHELL=/bin/zsh
引用:
[1]