From b5f14dad00d558caee2429d8cf03795f51167eb1 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Sun, 29 Sep 2013 18:59:17 +0200 Subject: [PATCH] =?utf8?q?Parce=20que=20hasher=20=C3=A0=20la=20main,=20c'e?= =?utf8?q?st=20trop=20mainstream.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- create_password.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 create_password.py diff --git a/create_password.py b/create_password.py new file mode 100755 index 0000000..237e384 --- /dev/null +++ b/create_password.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +# -*- coding:utf8 -*- + +"""Récupère en parmètre un mot de passe, le sale et le hashe en sha256. + Sort un format NK2015-compliant.""" + +table="azertyuiopqsdfghjklmwxcvbn0123456789" + +import random +import hashlib +import sys + +def random_chain(size): + return "".join([random.choice(table) for i in range(size)]) + +if __name__=="__main__": + password=sys.argv[1] + sel=random_chain(8) + hashed=hashlib.sha256(sel+password).hexdigest() + print sel+"|"+hashed -- 2.39.2