def snipeDecrypt(signature, cbkey, block, encryption): siglen = len(signature) if encryption: xorcypherdata = block[:16] cypherdata = byte_xor(cbkey, xorcypherdata) data = decrypt(cypherdata, encryption) if data[:siglen] == signature: return True else: sigcandidate = block[:siglen] if byte_xor(sigcandidate, cbkey) == signature: return True return False
def testDecrypt(bkey, block): count = 0 for subblock in grouper(16, block): dec = byte_xor(bkey, subblock) if dec == zeroBytes: count += 1 return count
def testSpeedInformedDecrypt(cbkey, block, encryption): for subblock in grouper(16, block): crypdec = byte_xor(cbkey, subblock) if encryption: dec = decrypt(crypdec, encryption) else: dec = crypdec if dec == zeroBytes: return True return False
def testSpeedDecrypt(bkey, block): for subblock in grouper(16, block): dec = byte_xor(bkey, subblock) if dec == zeroBytes: return True return False
def xorDecrypt(bkey, block): return byte_xor(cycle(bkey), block)