From 1d0ba15c12134e501325f29539f1c4dc2154e396 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Sun, 29 Sep 2013 19:01:05 +0200 Subject: [PATCH] =?utf8?q?Parce=20que=20hasher=20=C3=A0=20la=20main,=20c'e?= =?utf8?q?st=20trop=20mainstream.=20*2*?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- hashmdp.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 hashmdp.sh 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 -- 2.39.2