コード例 #1
0
'''
Created on Jun 9, 2015

@author: mewolot
'''

import Single_Byte as sb
from _ast import Num

file = open("key_hex_enc","r")
Hex = [line.strip("\n") for line in file]
file.close()

best = 0
BestList = []
for item in Hex:
    try:
        List, num = sb.bestScoring(item)
    except:
        continue
    if num > best:
        best = num
        BestList = List
    elif num == best:
        BestList = BestList + List
    else:
        pass

print BestList
print best
コード例 #2
0
'''
Created on Jun 9, 2015

@author: mewolot
'''

import Single_Byte as sb
from _ast import Num

file = open("SingleByteXOR","r")
Hex = [line.strip("\n") for line in file]
file.close()

best = 0
BestList = []
for item in Hex:
    try:
        List, num = sb.bestScoring(item)
    except:
        continue
    if num > best:
        best = num
        BestList = List
    elif num == best:
        BestList = BestList + List
    else:
        pass

print BestList
print best
コード例 #3
0
singleByteBlocks = []

for i in range(0, keySize):
    Block = []
    for b in splitBlocks:
        Block.append(b[i:i + 2])
    singleByteBlocks.append(Block)

print singleByteBlocks

Cracked = []
for b in singleByteBlocks:
    str = ""
    for item in b:
        str += item
    list = sb.bestScoring(str)
    #     print list
    betterList = []
    for item in list[0]:
        if "\\" not in item:
            betterList.append(item)
    for line in betterList:
        print line
    print

    Cracked.append(betterList)

print

reconstructed = []
コード例 #4
0
singleByteBlocks = []

for i in range(0,keySize):
    Block = []
    for b in splitBlocks:
        Block.append(b[i:i + 2])
    singleByteBlocks.append(Block)

print singleByteBlocks

Cracked = []
for b in singleByteBlocks:
    str = ""
    for item in b:
        str += item
    list = sb.bestScoring(str)
#     print list
    betterList = []
    for item in list[0]:
        if "\\" not in item:
            betterList.append(item)
    for line in betterList:
        print line
    print

    Cracked.append(betterList)
    
print

reconstructed = []