Skip to content

Instantly share code, notes, and snippets.

@hinnerk
Created January 7, 2014 19:35
Show Gist options
  • Save hinnerk/8305418 to your computer and use it in GitHub Desktop.
Save hinnerk/8305418 to your computer and use it in GitHub Desktop.
NIST AES 256 CTR Test Vectors.
# NIST AES 256 CTR test vector
key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4"
counter = (0xf0f1f2f3, 0xf4f5f6f7, 0xf8f9fafb, 0xfcfdfeff)
counter = ("\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")
nist = {'block1': {'plain': "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
'cipher':"\x60\x1e\xc3\x13\x77\x57\x89\xa5\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"},
'block2': {'plain': "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
'cipher':"\xf4\x43\xe3\xca\x4d\x62\xb5\x9a\xca\x84\xe9\x90\xca\xca\xf5\xc5"},
'block3': {'plain': "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
'cipher':"\x2b\x09\x30\xda\xa2\x3d\xe9\x4c\xe8\x70\x17\xba\x2d\x84\x98\x8d"},
'block4': {'plain': "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
'cipher':"\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6\x13\xc2\xdd\x08\x45\x79\x41\xa6"},}
lp = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10"
lc = "\x60\x1e\xc3\x13\x77\x57\x89\xa5\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28\xf4\x43\xe3\xca\x4d\x62\xb5\x9a\xca\x84\xe9\x90\xca\xca\xf5\xc5\x2b\x09\x30\xda\xa2\x3d\xe9\x4c\xe8\x70\x17\xba\x2d\x84\x98\x8d\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6\x13\xc2\xdd\x08\x45\x79\x41\xa6"
key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"
# Block 1
input1 = "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
output1 = "0bdf7df1591716335e9a8b15c860c502"
plain1 = "6bc1bee22e409f96e93d7e117393172a"
cipher1 = "601ec313775789a5b7a7f504bbf3d228"
# Block 2
input2 = "f0f1f2f3f4f5f6f7f8f9fafbfcfdff00"
output2 = "5a6e699d536119065433863c8f657b94"
plain2 = "ae2d8a571e03ac9c9eb76fac45af8e51"
cipher2 = "f443e3ca4d62b59aca84e990cacaf5c5"
# Block 3
input3 = "f0f1f2f3f4f5f6f7f8f9fafbfcfdff01"
output3 = "1bc12c9c01610d5d0d8bd6a3378eca62"
plain3 = "30c81c46a35ce411e5fbc1191a0a52ef"
cipher3 = "2b0930daa23de94ce87017ba2d84988d"
# Block 4
input4 = "f0f1f2f3f4f5f6f7f8f9fafbfcfdff02"
output4 = "2956e1c8693536b1bee99c73a31576b6"
plain4 = "f69f2445df4f9b17ad2b417be66c3710"
cipher4 = "dfc9c58db67aada613c2dd08457941a6"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment