Skip to content

Instantly share code, notes, and snippets.

@nmcv
Created November 23, 2014 19:29

Revisions

  1. Nikki McCavee created this gist Nov 23, 2014.
    32 changes: 32 additions & 0 deletions feistel_test.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/usr/bin/env python3


    import itertools
    import string
    from pprint import pprint
    from binascii import unhexlify, hexlify

    def cmp(a, b):

    xored_b = ''.join(['{:02x}'.format(b ^ 0xFF) for b in unhexlify(b)])

    if a == xored_b:
    print('{}:{} matches'.format(a, b))

    else:
    print('{}:{} x '.format(a, b))

    def main():
    cmp('29634d75', '8d91d162')
    cmp('25b14856', '107f0959')
    cmp('6d4e0fdc', '92b1f023')
    cmp('c3c36462', '3c3c9b9d')
    cmp('fc617adb', '260568f5')
    cmp('3a894ef6', '86d11f43')
    cmp('ddd87290', '22278d6f')
    cmp('91612be2', '6e9ed41d')
    cmp('9ef66c9f', '60692649')
    cmp('fb3549e8', 'a9a871d5')


    main()