You are here: Main Site >> Codebase >> Python >> Hash Generator 
 

Hash Generator

hartsmor
CodeCount: 19
Posted: 8th March 07:09pm

Information:

A tiny hash generator that supports all algorithms offered in "hashlib".

Python Code:
import hashlib, sys, time
 
hashes0 = "md2 md4 md5 ripemd sha1 sha256 sha512"
hashes = hashes0.split()
length = len(hashes)
if len(sys.argv)!= 2:
	print "<input>"
	sys.exit(1)
 
data = sys.argv[1]
x = 0
 
def generate():
	global x
	global data
	while data != "":
		if x == len(hashes):
			break
		h = hashlib.new(hashes[x])
		h.update(data)
		hash = h.hexdigest()
		print "\n" + hashes[x] + ": " + '"' + hash + '"'
		x = x + 1
generate()

Comments

Information:

No Comments.