def apply_hash(self, s): """Apply MD5 to a string <s>, then wrap it in base64 encoding.""" m = md5() m.update(s) d = m.digest() # base64.encodestring tacks on an extra linefeed. return encodestring(d)[:-1]
def hex_digest (s): m = md5() m.update(s) return ''.join([hex (ord (x))[2:] for x in list(m.digest())])