Hacl: refactoring
This commit is contained in:
parent
928ee9d3a0
commit
a224c80462
31
vendors/ocaml-hacl/src/hacl.ml
vendored
31
vendors/ocaml-hacl/src/hacl.ml
vendored
@ -32,7 +32,7 @@ module Rand = struct
|
||||
end
|
||||
|
||||
module Hash = struct
|
||||
module type S = sig
|
||||
module type HASH = sig
|
||||
val init : Bigstring.t -> unit
|
||||
val update : Bigstring.t -> Bigstring.t -> unit
|
||||
val update_last : Bigstring.t -> Bigstring.t -> int -> unit
|
||||
@ -43,7 +43,7 @@ module Hash = struct
|
||||
val statebytes : int
|
||||
end
|
||||
|
||||
module Make(S: S) = struct
|
||||
module Make(S: HASH) = struct
|
||||
type state = {
|
||||
state : Bigstring.t ;
|
||||
buf : Bigstring.t ;
|
||||
@ -87,6 +87,33 @@ module Hash = struct
|
||||
finish st
|
||||
end
|
||||
|
||||
module type S = sig
|
||||
type state
|
||||
|
||||
val bytes : int
|
||||
val blockbytes : int
|
||||
val statebytes : int
|
||||
|
||||
(** Incremental Interface *)
|
||||
|
||||
val init : unit -> state
|
||||
val update : state -> Bigstring.t -> unit
|
||||
val finish : state -> Bigstring.t
|
||||
|
||||
(** Direct Interface *)
|
||||
|
||||
val digest : Bigstring.t -> Bigstring.t
|
||||
|
||||
module HMAC : sig
|
||||
val write :
|
||||
key:Bigstring.t -> msg:Bigstring.t -> Bigstring.t -> unit
|
||||
(** @raise [Invalid_argument] if argument is less than 32 bytes long *)
|
||||
|
||||
val digest :
|
||||
key:Bigstring.t -> msg:Bigstring.t -> Bigstring.t
|
||||
end
|
||||
end
|
||||
|
||||
module SHA256 = struct
|
||||
module H = Make(struct
|
||||
(* state -> unit *)
|
||||
|
30
vendors/ocaml-hacl/src/hacl.mli
vendored
30
vendors/ocaml-hacl/src/hacl.mli
vendored
@ -28,7 +28,7 @@ module Rand : sig
|
||||
end
|
||||
|
||||
module Hash : sig
|
||||
module SHA256 : sig
|
||||
module type S = sig
|
||||
type state
|
||||
|
||||
val bytes : int
|
||||
@ -55,32 +55,8 @@ module Hash : sig
|
||||
end
|
||||
end
|
||||
|
||||
module SHA512 : sig
|
||||
type state
|
||||
|
||||
val bytes : int
|
||||
val blockbytes : int
|
||||
val statebytes : int
|
||||
|
||||
(** Incremental Interface *)
|
||||
|
||||
val init : unit -> state
|
||||
val update : state -> Bigstring.t -> unit
|
||||
val finish : state -> Bigstring.t
|
||||
|
||||
(** Direct Interface *)
|
||||
|
||||
val digest : Bigstring.t -> Bigstring.t
|
||||
|
||||
module HMAC : sig
|
||||
val write :
|
||||
key:Bigstring.t -> msg:Bigstring.t -> Bigstring.t -> unit
|
||||
(** @raise [Invalid_argument] if argument is less than 32 bytes long *)
|
||||
|
||||
val digest :
|
||||
key:Bigstring.t -> msg:Bigstring.t -> Bigstring.t
|
||||
end
|
||||
end
|
||||
module SHA256 : S
|
||||
module SHA512 : S
|
||||
end
|
||||
|
||||
module Nonce : sig
|
||||
|
Loading…
Reference in New Issue
Block a user