Some documentation
This commit is contained in:
parent
3deea9a0e1
commit
ca4407e8ec
|
@ -351,10 +351,15 @@ let mds_rem a b =
|
|||
in
|
||||
mds_rem_ab ((Int64.of_int32 a) & 0xFFFFFFFFL) ((Int64.of_int32 b) & 0xFFFFFFFFL) 0
|
||||
|
||||
let key_size = 32
|
||||
|
||||
let init key =
|
||||
let keylength = String.length key in
|
||||
if keylength != 32 then
|
||||
failwith ("init: key length must be 32, got key length "^string_of_int (keylength))
|
||||
if keylength != key_size then
|
||||
failwith (Printf.sprintf
|
||||
"init: key length must be %d, got key length %d"
|
||||
key_size
|
||||
(string_of_int keylength))
|
||||
else
|
||||
let le_longs = unpack_longs key 8 in
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
type ctx
|
||||
(** Some context? *)
|
||||
(* XXX: Is this stateful?? *)
|
||||
val key_size : int
|
||||
(** [key_size] is the size of twofish keys. *)
|
||||
val init : string -> ctx
|
||||
(** [init key] is the context / state initialized from secret key [key]. *)
|
||||
val encrypt : ctx -> string -> string
|
||||
(** [encrypt ctx plain_text] is a single block encrypted with [ctx]. *)
|
||||
val decrypt : ctx -> string -> string
|
||||
(** [encrypt ctx cipher_text] is a single block decrypted with [ctx]. *)
|
||||
|
|
Loading…
Reference in a new issue