def __init__(self, string): MD5.__init__(self) self.preimage = string # convert string to a list of ascii bytes inText = map(lambda x: ord(x), string) self.update(inText, len(inText)) self.finish()
def __init__(self, string): MD5.__init__(self) self.preimage = string # convert string to a list of ascii bytes inText = map( lambda x: ord(x), string ) self.update(inText, len(inText)) self.finish()
def __init__(self, filename=None): MD5.__init__(self) self.filename = filename self.filehandle = open(self.filename, "rb") for inString in iter(self.read1KB, ''): # Convert ascii to a list of bytes # TODO: Why do I need to do this when I am reading binary??? curr_1k_block = map(lambda x: ord(x), inString) self.update(curr_1k_block, len(curr_1k_block)) self.finish() self.filehandle.close()
def __init__(self, filename=None): MD5.__init__(self) self.filename = filename self.filehandle = open(self.filename, "rb") for inString in iter(self.read1KB, ''): # Convert ascii to a list of bytes # TODO: Why do I need to do this when I am reading binary??? curr_1k_block = map( lambda x: ord(x), inString ) self.update(curr_1k_block, len(curr_1k_block)) self.finish() self.filehandle.close()
def __init__(self): self._sqlobj = SelectFromMysql() self._otherobj = Produce() self._configobj = LoadConfig() self._md5obj = MD5() self._HTTP_CODE = [ '200', '201', '301', '302', '400', '401', '500', '504', '403', '405', '404', '502' ] self._SUCCESS_CODE = '1000' self._configpath = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) pass
def md5_2017(md5pool, index): md5 = MD5() with md5pool.lock: if index in md5pool.inProgress or index in md5pool.finished: print('error {} already in inProgress'.format(index)) return md5pool.inProgress.add(index) result = '{}{}'.format(md5pool.input, index) for i in range(0, 2017): result = md5.calculate(result) with md5pool.lock: md5pool.inProgress.remove(index) md5pool.finished.setdefault(index, result) if md5pool.running: md5pool.pushNext(index) return
from MD5 import MD5 md5 = MD5() hexList = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] searchList = dict() foundList = list() targetFoundListSize = 64 possibleAnswer = dict() for h in hexList: possibleAnswer.setdefault(h,list()) searchList.setdefault(h, h*5) index = 0 maxGap = 1000 input = 'zpqevtbw' min3 = maxGap min3letterList = list() min5 = maxGap min5letterList = list() while len(foundList) < targetFoundListSize: saltedInput = '{}{}'.format(input, index) result = md5.calculate(saltedInput) min3 = maxGap min3letter = None min5 = maxGap
def __str__(self): return MD5.__str__(self)
def md5(text=""): return MD5(text)
def __str__(self): return "MD5 (" + self.filename + "): " + MD5.__str__(self)
def __str__(self): return "MD5 (" + self.preimage + "): " + MD5.__str__(self)
def run_test (inText): inText = map( lambda x: ord(x), inText ) md = MD5() md.update(inText, len(inText)) md.finish() return str(md)
def run_test(inText): inText = map(lambda x: ord(x), inText) md = MD5() md.update(inText, len(inText)) md.finish() print md
inText = map(lambda x: ord(x), inText) md = MD5() md.update(inText, len(inText)) md.finish() print md def runTestCases(): test_inputs = [ "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", \ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", \ "12345678901234567890123456789012345678901234567890123456789012345678901234567890", \ "The quick brown fox jumps over the lazy dog" \ ] for i in test_inputs: run_test(i) runTestCases() ''' MD5 ("") = d41d8cd98f00b204e9800998ecf8427e MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a MD5 ("The quick brown fox jumps over the lazy dog"): 9e107d9d372bb6826bd81d3542a419d6 '''