Debian Codegraph @

cmp_cryptgps/des

raw symbols SCIP
1 #! /bin/sh
2 # (*
3 exec ocaml "$0"
4 *) directory "..";;
5
6 #load "cryptgps.cma";;
7
8 open Crypt_des;;
9 open Cryptsystem;;
10 open Cryptmodes;;
11 let k = prepare (set_parity "abcdefgh");;
12
13 let print s =
14 let l = String.length s in
15 for i = 0 to l/2-1 do
16 let j = 2*i in
17 print_char ' ';
18 print_int ((Char.code(s.[j]) lsl 8 ) lor (Char.code(s.[j+1])))
19 done
20 ;;
21
22
23 let (x3,x2,x1,x0) = encrypt_ecb k (0x3132,0x3334,0x3536,0x3738);;
24 Printf.printf "Result ECB: %d %d %d %d\n" x3 x2 x1 x0;;
25
26 let (v, s) = encrypt_cbc k (0,0,0,0) "12345678abcdefgh";;
27 print_string "Result CBC:";
28 print s;
29 print_newline()
30 ;;
31
32 let (v, _, s) = encrypt_cfb64 k (0,0,0,0) 0 "12345678abcdefgh";;
33 print_string "Result CFB-64:";
34 print s;
35 print_newline()
36 ;;
37
38 let (v, _, s) = crypt_ofb k (0,0,0,0) 0 "12345678abcdefgh";;
39 print_string "Result OFB:";
40 print s;
41 print_newline()
42 ;;