Skip to content

Instantly share code, notes, and snippets.

@SonOfLilit
Created July 26, 2013 21:22
Show Gist options
  • Save SonOfLilit/6092322 to your computer and use it in GitHub Desktop.
Save SonOfLilit/6092322 to your computer and use it in GitHub Desktop.
TEST_CASES = [
('\x00', '37CE6F8BDF1ECE1E6771D61F3477C4EE71CF3793A0'),
('\x01\x02\x03\x04', '060960EAF8755D47AB14F62948CEE0ED010378755BB4A788'),
('\xFF', '0D295288F8563D9AA6324875B3EA7A9C841321F6CD'),
# watch out: not '\xFF\xFF'. Typo is my fault.
('\xFFFF', '88C41CB3F295FD198F0351D44A1AF4BE4DB526D3341C52'),
(''.join(map(chr, xrange(256))), '5E78B8D2B8A93AF01590AB44E647F8D0CFF663E3E120479B0C903E76199A6B8CA1B2073583B63A4A28A31C34B3B6355175983CEB7C452731712C83F6AE551511BBE2827603F1F4B8714E8A8584BD75B04811CFA65CDA95DB47E7F35BD49443FF2820C2AAA35E6B0701F932053212976A94EBDFA96F87FE7E9FA4E52CC87322E4A6B75AE762BC72704D2C48BF8A374C31B5D6733F5B1C42B85A7306FF8B4273DFE423845141B2777049FFEBB2730EBC8684FAA69371834FDF6A5F3850D4E185E2DFE16A860AF376FCCB34CA86068D08E8760B3C9A3C32511EE39EF38EECF2A89A2324BE0661A044313C7C3F160193B4C000A5D6EC7711FEF5D1EDCB95C455A9DF9438644D50F51928EED7F17CA42D589DD78D36C5')]
if __name__ == '__main__':
for plain, cipher in TEST_CASES:
assert encrypt(plain) == cipher, \
"%s: %s != %s" % (plain.encode('hex').upper(), cipher, encrypt(plain))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment