Beispiel #1
0
def findAllGenerators():
    for n in range(2, 9):
        gen, sample = findNBitGenerators(n)
        print "\n%d-bit generators in the AES Galois Field:" % n
        hexDump(gen, prefix="\t")
        print "\nSample sequence:"
        hexDump(sample, prefix="\t")
Beispiel #2
0
def findAllGenerators():
    for n in range(2, 9):
        gen, sample = findNBitGenerators(n)
        print "\n%d-bit generators in the AES Galois Field:" % n
        hexDump(gen, prefix="\t")
        print "\nSample sequence:"
        hexDump(sample, prefix="\t")
Beispiel #3
0
def testCRCBytes():
    # Try out our experimental CRC function!
    inputString = map(ord, "this is a test.....\0\0\0\0\0\1\1\1\1\1\2\2\2\2\2\3\3\3\3\3")
    crcString = []
    reg = 0
    for byte in inputString:
        reg = xcrc(byte, reg)
        crcString.append(reg)
    print "\nTest string:"
    hexDump(inputString, prefix="\t")
    print "\nCRC after each byte of test string:"
    hexDump(crcString, prefix="\t")
Beispiel #4
0
def testCRCBytes():
    # Try out our experimental CRC function!
    inputString = map(
        ord, "this is a test.....\0\0\0\0\0\1\1\1\1\1\2\2\2\2\2\3\3\3\3\3")
    crcString = []
    reg = 0
    for byte in inputString:
        reg = xcrc(byte, reg)
        crcString.append(reg)
    print "\nTest string:"
    hexDump(inputString, prefix="\t")
    print "\nCRC after each byte of test string:"
    hexDump(crcString, prefix="\t")
Beispiel #5
0
def testCRCBitErrors():
    print "\nEvaluating bit-error detection for generators:"
    best = None
    for gen in findNBitGenerators(8)[0]:
        if not testOneToOneProperty(gen):
            print "\t%02x: (not 1:1)" % gen
            continue

        hist = bitErrorDetectionHistogram(gen)
        score = scoreHistogram(hist)
        print "\t%02x: Score %f" % (gen, score)
        if best is None or score < best[0]:
            best = (score, gen, hist)

    print "\nHistogram for best (%02x):" % best[1]
    hexDump(best[2], prefix="\t")
Beispiel #6
0
def testCRCBitErrors():
    print "\nEvaluating bit-error detection for generators:"
    best = None
    for gen in findNBitGenerators(8)[0]:
        if not testOneToOneProperty(gen):
            print "\t%02x: (not 1:1)" % gen
            continue

        hist = bitErrorDetectionHistogram(gen)
        score = scoreHistogram(hist)
        print "\t%02x: Score %f" % (gen, score)
        if best is None or score < best[0]:
            best = (score, gen, hist)

    print "\nHistogram for best (%02x):" % best[1]
    hexDump(best[2], prefix="\t")