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

Last change on this file since 13161 was 13161, checked in by Ivan Raikov, 12 years ago

Added all aes files.

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