Fixed spacing in hexdump()

This commit is contained in:
icefire 2009-06-12 13:04:40 -07:00
parent 303e0c379e
commit 98658b969d

View File

@ -7,8 +7,8 @@ from Struct import Struct
def align(x, boundary): def align(x, boundary):
return x + (x % boundary) return x + (x % boundary)
def hexdump(s,sep=" "): def hexdump(s, sep=" "):
return sep.join(map(lambda x: "%02x"%ord(x),s)) return sep.join(map(lambda x: "%02x" % ord(x), s))
class Crypto: class Crypto:
"""This is a Cryptographic/hash class used to abstract away things (to make changes easier)""" """This is a Cryptographic/hash class used to abstract away things (to make changes easier)"""
@ -22,7 +22,7 @@ class Crypto:
else: else:
return AES.new(titlekey, AES.MODE_CBC, iv).decrypt(data) return AES.new(titlekey, AES.MODE_CBC, iv).decrypt(data)
def ValidateHash(self, data, hash): def ValidateHash(self, data, hash):
"""Validates a hash. (BROKEN)""" """Validates a hash. Not checking currently because we have some...issues with hashes."""
return 1 #hack return 1 #hack
# if(hashlib.sha1(data).hexdigest() == hexdump(hash, "")): # if(hashlib.sha1(data).hexdigest() == hexdump(hash, "")):
# return 1 # return 1