]> git.parisson.com Git - yomguy-tools.git/commitdiff
add time based md5 key tool
authoryomguy <yomguy@parisson.com>
Mon, 5 Mar 2012 12:38:34 +0000 (13:38 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 5 Mar 2012 12:38:34 +0000 (13:38 +0100)
various/make_id.py [new file with mode: 0644]

diff --git a/various/make_id.py b/various/make_id.py
new file mode 100644 (file)
index 0000000..486c86e
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import sys
+import hashlib, time, base64
+
+def makeSessionId(st):
+    m = hashlib.md5()
+    m.update('this is a test of the emergency broadcasting system')
+    m.update(str(time.time()))
+    m.update(str(st))
+    return base64.encodestring(m.digest())[:-3].replace('/', '$')
+
+print makeSessionId(sys.argv[-1])
+