From: Vincent Le Gallic Date: Sun, 29 Sep 2013 17:01:05 +0000 (+0200) Subject: Parce que hasher à la main, c'est trop mainstream. *2* X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=commitdiff_plain;h=1d0ba15c12134e501325f29539f1c4dc2154e396 Parce que hasher à la main, c'est trop mainstream. *2* --- diff --git a/hashmdp.sh b/hashmdp.sh new file mode 100755 index 0000000..14368fc --- /dev/null +++ b/hashmdp.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Script pour hasher en md5 une chaîne de caractères grâce à python + +if [ ! $1 ] +then + echo "Usage : hashmdp [-sha] une_chaine" + exit 1 +else + if [ "$1" = "-sha" ] + then + python -c "import hashlib;print hashlib.sha256('$2').hexdigest()" + else + python -c "import hashlib;print hashlib.md5('$1').hexdigest()" + fi +fi