source: project/release/3/aes/trunk/test/run.scm @ 13195

Last change on this file since 13195 was 13195, checked in by Alaric Snell-Pym, 11 years ago

V1.1 (crypto tools split out)

File size: 2.8 KB
Line 
1(use aes)
2(use crypto-tools)
3
4(let*
5   ((encryptor (make-aes128-encryptor (hexstring->blob "00010203050607080A0B0C0D0F101112")))
6    (decryptor (make-aes128-decryptor (hexstring->blob "00010203050607080A0B0C0D0F101112")))
7    (encrypted (encryptor (hexstring->blob "506812A45F08C889B97F5980038B8359")))
8    (encrypted-string (blob->hexstring/uppercase encrypted))
9    (decrypted (decryptor encrypted))
10    (decrypted-string (blob->hexstring/uppercase decrypted)))
11   
12   (printf "Test vector 1a: ~A\n" encrypted-string)
13   (printf "Test vector 1b: ~A\n" decrypted-string)
14   (assert (string=? encrypted-string "D8F532538289EF7D06B506A4FD5BE9C9"))
15   (assert (string=? decrypted-string "506812A45F08C889B97F5980038B8359")))
16
17(let*
18   ((encryptor (make-aes128-encryptor (hexstring->blob "E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FA")))
19    (decryptor (make-aes128-decryptor (hexstring->blob "E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FA")))
20    (encrypted (encryptor (hexstring->blob "014BAF2278A69D331D5180103643E99A")))
21    (encrypted-string (blob->hexstring/uppercase encrypted))
22    (decrypted (decryptor encrypted))
23    (decrypted-string (blob->hexstring/uppercase decrypted)))
24   
25   (printf "Test vector 2a: ~A\n" encrypted-string)
26   (printf "Test vector 2b: ~A\n" decrypted-string)
27   (assert (string=? encrypted-string "6743C3D1519AB4F2CD9A78AB09A511BD"))
28   (assert (string=? decrypted-string "014BAF2278A69D331D5180103643E99A")))
29
30(let*
31   ((encryptor (make-aes192-encryptor (hexstring->blob "04050607090A0B0C0E0F10111314151618191A1B1D1E1F20")))
32    (decryptor (make-aes192-decryptor (hexstring->blob "04050607090A0B0C0E0F10111314151618191A1B1D1E1F20")))
33    (encrypted (encryptor (hexstring->blob "76777475F1F2F3F4F8F9E6E777707172")))
34    (encrypted-string (blob->hexstring/uppercase encrypted))
35    (decrypted (decryptor encrypted))
36    (decrypted-string (blob->hexstring/uppercase decrypted)))
37   
38   (printf "Test vector 3a: ~A\n" encrypted-string)
39   (printf "Test vector 3b: ~A\n" decrypted-string)
40   (assert (string=? encrypted-string "5D1EF20DCED6BCBC12131AC7C54788AA"))
41   (assert (string=? decrypted-string "76777475F1F2F3F4F8F9E6E777707172")))
42
43(let*
44   ((encryptor (make-aes256-encryptor (hexstring->blob "08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E")))
45    (decryptor (make-aes256-decryptor (hexstring->blob "08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E")))
46    (encrypted (encryptor (hexstring->blob "069A007FC76A459F98BAF917FEDF9521")))
47    (encrypted-string (blob->hexstring/uppercase encrypted))
48    (decrypted (decryptor encrypted))
49    (decrypted-string (blob->hexstring/uppercase decrypted)))
50   
51   (printf "Test vector 4a: ~A\n" encrypted-string)
52   (printf "Test vector 4b: ~A\n" decrypted-string)
53   (assert (string=? encrypted-string "080E9517EB1677719ACF728086040AE3"))
54   (assert (string=? decrypted-string "069A007FC76A459F98BAF917FEDF9521")))
Note: See TracBrowser for help on using the repository browser.