Commit 5830e81d authored by gerd's avatar gerd

Updated


git-svn-id: https://godirepo.camlcity.org/svn/lib-cryptgps/trunk@20 b101cce4-44db-0310-b718-db4b2d8d2e05
parent 9f6dfb25
version = "0.1.2"
version = "0.2"
requires = ""
archive(byte) = "cryptgps.cma"
archive(native) = "cryptgps.cmxa"
......
......@@ -93,5 +93,7 @@ See the file "LICENSE".
CHANGES
0.2: Experimental support for int32 calculations: Blowfish32
0.1.2: Updated URLs in documentation.
top:
ocamlfind ocamlmktop -o top -package bigarray -custom -linkpkg
#! /bin/sh
# (*
exec ocaml "$0"
exec ./top "$0"
*) directory "..";;
#load "cryptgps.cma";;
......@@ -29,12 +29,39 @@ print s;
print_newline()
;;
let (v, s) = encrypt_cfb8 k (0,0,0,0) "12345678abcdefgh";;
print_string "Result CFB-8:";
print s;
print_newline()
;;
let (v, _, s) = encrypt_cfb64 k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result CFB-64:";
print s;
print_newline()
;;
let (x3,x2,x1,x0) = decrypt_ecb k (0x3132,0x3334,0x3536,0x3738);;
Printf.printf "Result de-ECB: %d %d %d %d\n" x3 x2 x1 x0;;
let (v, s) = decrypt_cbc k (0,0,0,0) "12345678abcdefgh";;
print_string "Result de-CBC:";
print s;
print_newline()
;;
let (v, s) = decrypt_cfb8 k (0,0,0,0) "12345678abcdefgh";;
print_string "Result de-CFB-8:";
print s;
print_newline()
;;
let (v, _, s) = decrypt_cfb64 k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result de-CFB-64:";
print s;
print_newline()
;;
let (v, _, s) = crypt_ofb k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result OFB:";
print s;
......
#! /bin/sh
# (*
exec ./top "$0" "$@"
*) directory "..";;
#load "cryptgps.cma";;
open Crypt_blowfish32;;
open Cryptsystem;;
open Cryptmodes;;
let k = prepare "abcdefghijklmnop";;
let print s =
let l = String.length s in
for i = 0 to l/2-1 do
let j = 2*i in
print_char ' ';
print_int ((Char.code(s.[j]) lsl 8 ) lor (Char.code(s.[j+1])))
done
;;
let (x3,x2,x1,x0) = encrypt_ecb k (0x3132,0x3334,0x3536,0x3738);;
Printf.printf "Result ECB: %d %d %d %d\n" x3 x2 x1 x0;;
let (v, s) = encrypt_cbc k (0,0,0,0) "12345678abcdefgh";;
print_string "Result CBC:";
print s;
print_newline()
;;
let (v, s) = encrypt_cfb8 k (0,0,0,0) "12345678abcdefgh";;
print_string "Result CFB-8:";
print s;
print_newline()
;;
let (v, _, s) = encrypt_cfb64 k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result CFB-64:";
print s;
print_newline()
;;
let (x3,x2,x1,x0) = decrypt_ecb k (0x3132,0x3334,0x3536,0x3738);;
Printf.printf "Result de-ECB: %d %d %d %d\n" x3 x2 x1 x0;;
let (v, s) = decrypt_cbc k (0,0,0,0) "12345678abcdefgh";;
print_string "Result de-CBC:";
print s;
print_newline()
;;
let (v, s) = decrypt_cfb8 k (0,0,0,0) "12345678abcdefgh";;
print_string "Result de-CFB-8:";
print s;
print_newline()
;;
let (v, _, s) = decrypt_cfb64 k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result de-CFB-64:";
print s;
print_newline()
;;
let (v, _, s) = crypt_ofb k (0,0,0,0) 0 "12345678abcdefgh";;
print_string "Result OFB:";
print s;
print_newline()
;;
......@@ -6,10 +6,10 @@ all: speed_blowfish_byte speed_blowfish_native speed_blowfish_c \
speed_des_byte speed_des_native speed_des_c
speed_blowfish_byte: speed_blowfish.ml ../cryptgps.cma
ocamlc -o speed_blowfish_byte -I .. ../cryptgps.cma speed_blowfish.ml
ocamlc -o speed_blowfish_byte -I .. bigarray.cma ../cryptgps.cma speed_blowfish.ml
speed_blowfish_native: speed_blowfish.ml ../cryptgps.cmxa
ocamlopt -o speed_blowfish_native -I .. ../cryptgps.cmxa speed_blowfish.ml
ocamlopt -o speed_blowfish_native -I .. bigarray.cmxa ../cryptgps.cmxa speed_blowfish.ml
speed_blowfish_c: speed_blowfish.c
$(CC) -o speed_blowfish_c speed_blowfish.c -lcrypto
......
open Crypt_blowfish;;
open Crypt_blowfish;; (* or Crypt_blowfish32 *)
open Cryptsystem;;
open Cryptmodes;;
let k = prepare "abcdefghijklmnop";;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment