X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=hashmdp.sh;fp=hashmdp.sh;h=14368fcb7817f3d909f56d5ce9b144aa603d597a;hb=1d0ba15c12134e501325f29539f1c4dc2154e396;hp=0000000000000000000000000000000000000000;hpb=bfd2a3376b8a7a8f54603028b9d0384f9a2e8fa4;p=scripts-20-100.git 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