From ee817819e8a2d61eb0a2a3327521bfa9aaaecdc0 Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Mon, 15 Jun 2020 15:01:52 +0200 Subject: [PATCH] Apply ocamlformat.0.14.2 pass --- .ocamlformat | 14 +- src-c/digestif.ml | 365 +++-- src-c/digestif_native.ml | 189 +-- src-ocaml/baijiu_blake2b.ml | 384 +++-- src-ocaml/baijiu_blake2s.ml | 311 ++-- src-ocaml/baijiu_md5.ml | 67 +- src-ocaml/baijiu_rmd160.ml | 95 +- src-ocaml/baijiu_sha1.ml | 76 +- src-ocaml/baijiu_sha224.ml | 31 +- src-ocaml/baijiu_sha256.ml | 180 ++- src-ocaml/baijiu_sha384.ml | 32 +- src-ocaml/baijiu_sha512.ml | 217 ++- src-ocaml/baijiu_whirlpool.ml | 2836 ++++++++++++++++++++++++--------- src-ocaml/digestif.ml | 346 ++-- src-ocaml/xor.ml | 17 +- src/digestif.mli | 175 +- src/digestif_bi.ml | 19 +- src/digestif_by.ml | 15 +- src/digestif_conv.ml | 33 +- src/digestif_eq.ml | 2 + src/digestif_hash.ml | 29 +- test/conv/test_conv.ml | 69 +- test/test.ml | 496 +++--- 23 files changed, 4030 insertions(+), 1968 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index 8b83b5e..d59e16a 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,6 +1,8 @@ -module-item-spacing=compact -break-struct=natural -break-infix=fit-or-vertical -parens-tuple=multi-line-only -wrap-comments=true -break-collection-expressions=wrap \ No newline at end of file +version = 0.14.2 +break-infix = fit-or-vertical +parse-docstrings = true +indicate-multiline-delimiters=no +nested-match=align +sequence-style=separator +break-before-in=auto +if-then-else=keyword-first diff --git a/src-c/digestif.ml b/src-c/digestif.ml index 51b7a61..43e2d6c 100644 --- a/src-c/digestif.ml +++ b/src-c/digestif.ml @@ -1,9 +1,15 @@ type bigstring = - (char, Bigarray_compat.int8_unsigned_elt, Bigarray_compat.c_layout) Bigarray_compat.Array1.t + ( char, + Bigarray_compat.int8_unsigned_elt, + Bigarray_compat.c_layout ) + Bigarray_compat.Array1.t type 'a iter = ('a -> unit) -> unit + type 'a compare = 'a -> 'a -> int + type 'a equal = 'a -> 'a -> bool + type 'a pp = Format.formatter -> 'a -> unit module Native = Digestif_native @@ -19,47 +25,87 @@ module type S = sig val digest_size : int type ctx + type kind + type t val kind : kind + val empty : ctx + val init : unit -> ctx + val feed_bytes : ctx -> ?off:int -> ?len:int -> Bytes.t -> ctx + val feed_string : ctx -> ?off:int -> ?len:int -> String.t -> ctx + val feed_bigstring : ctx -> ?off:int -> ?len:int -> bigstring -> ctx + val feedi_bytes : ctx -> Bytes.t iter -> ctx + val feedi_string : ctx -> String.t iter -> ctx + val feedi_bigstring : ctx -> bigstring iter -> ctx + val get : ctx -> t + val digest_bytes : ?off:int -> ?len:int -> Bytes.t -> t + val digest_string : ?off:int -> ?len:int -> String.t -> t + val digest_bigstring : ?off:int -> ?len:int -> bigstring -> t + val digesti_bytes : Bytes.t iter -> t + val digesti_string : String.t iter -> t + val digesti_bigstring : bigstring iter -> t + val digestv_bytes : Bytes.t list -> t + val digestv_string : String.t list -> t + val digestv_bigstring : bigstring list -> t + val hmac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t + val hmac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t + val hmac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t + val hmaci_bytes : key:Bytes.t -> Bytes.t iter -> t + val hmaci_string : key:String.t -> String.t iter -> t + val hmaci_bigstring : key:bigstring -> bigstring iter -> t + val hmacv_bytes : key:Bytes.t -> Bytes.t list -> t + val hmacv_string : key:String.t -> String.t list -> t + val hmacv_bigstring : key:bigstring -> bigstring list -> t + val unsafe_compare : t compare + val equal : t equal + val pp : t pp + val of_hex : string -> t + val of_hex_opt : string -> t option + val consistent_of_hex : string -> t + val consistent_of_hex_opt : string -> t option + val to_hex : t -> string + val of_raw_string : string -> t + val of_raw_string_opt : string -> t option + val to_raw_string : t -> string end @@ -67,13 +113,21 @@ module type MAC = sig type t val mac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t + val mac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t + val mac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t + val maci_bytes : key:Bytes.t -> Bytes.t iter -> t + val maci_string : key:String.t -> String.t iter -> t + val maci_bigstring : key:bigstring -> bigstring iter -> t + val macv_bytes : key:Bytes.t -> Bytes.t list -> t + val macv_string : key:String.t -> String.t list -> t + val macv_bigstring : key:bigstring -> bigstring list -> t end @@ -84,13 +138,17 @@ module type Foreign = sig module Bigstring : sig val init : ctx -> unit + val update : ctx -> ba -> int -> int -> unit + val finalize : ctx -> ba -> int -> unit end module Bytes : sig val init : ctx -> unit + val update : ctx -> st -> int -> int -> unit + val finalize : ctx -> st -> int -> unit end @@ -101,33 +159,38 @@ module type Desc = sig type kind val block_size : int + val digest_size : int + val kind : kind end module Unsafe (F : Foreign) (D : Desc) = struct let block_size = D.block_size + and digest_size = D.digest_size + and ctx_size = F.ctx_size () let init () = let t = By.create ctx_size in - F.Bytes.init t ; t + F.Bytes.init t ; + t let empty = let buf = Bytes.create ctx_size in - F.Bytes.init buf ; buf + F.Bytes.init buf ; + buf let unsafe_feed_bytes t ?off ?len buf = let off, len = - match off, len with - | Some off, Some len -> off, len - | Some off, None -> off, By.length buf - off - | None, Some len -> 0, len - | None, None -> 0, By.length buf - in - if off < 0 || len < 0 || off > By.length buf - len then - invalid_arg "offset out of bounds" + match (off, len) with + | Some off, Some len -> (off, len) + | Some off, None -> (off, By.length buf - off) + | None, Some len -> (0, len) + | None, None -> (0, By.length buf) in + if off < 0 || len < 0 || off > By.length buf - len + then invalid_arg "offset out of bounds" else F.Bytes.update t buf off len let unsafe_feed_string t ?off ?len buf = @@ -135,25 +198,27 @@ module Unsafe (F : Foreign) (D : Desc) = struct let unsafe_feed_bigstring t ?off ?len buf = let off, len = - match off, len with - | Some off, Some len -> off, len - | Some off, None -> off, Bi.length buf - off - | None, Some len -> 0, len - | None, None -> 0, Bi.length buf - in - if off < 0 || len < 0 || off > Bi.length buf - len then - invalid_arg "offset out of bounds" + match (off, len) with + | Some off, Some len -> (off, len) + | Some off, None -> (off, Bi.length buf - off) + | None, Some len -> (0, len) + | None, None -> (0, Bi.length buf) in + if off < 0 || len < 0 || off > Bi.length buf - len + then invalid_arg "offset out of bounds" else F.Bigstring.update t buf off len let unsafe_get t = let res = By.create digest_size in By.fill res 0 digest_size '\000' ; - F.Bytes.finalize t res 0 ; res + F.Bytes.finalize t res 0 ; + res end module Core (F : Foreign) (D : Desc) = struct type t = string + type ctx = Native.ctx + type kind = F.kind include Unsafe (F) (D) @@ -184,29 +249,37 @@ module Core (F : Foreign) (D : Desc) = struct let feedi_bytes t iter = let t = Native.dup t in let feed buf = unsafe_feed_bytes t buf in - iter feed ; t + iter feed ; + t let feedi_string t iter = let t = Native.dup t in let feed buf = unsafe_feed_string t buf in - iter feed ; t + iter feed ; + t let feedi_bigstring t iter = let t = Native.dup t in let feed buf = unsafe_feed_bigstring t buf in - iter feed ; t + iter feed ; + t let digest_bytes ?off ?len buf = feed_bytes empty ?off ?len buf |> get + let digest_string ?off ?len buf = feed_string empty ?off ?len buf |> get - let digest_bigstring ?off ?len buf = - feed_bigstring empty ?off ?len buf |> get + let digest_bigstring ?off ?len buf = feed_bigstring empty ?off ?len buf |> get let digesti_bytes iter = feedi_bytes empty iter |> get + let digesti_string iter = feedi_string empty iter |> get + let digesti_bigstring iter = feedi_bigstring empty iter |> get + let digestv_bytes lst = digesti_bytes (fun f -> List.iter f lst) + let digestv_string lst = digesti_string (fun f -> List.iter f lst) + let digestv_bigstring lst = digesti_bigstring (fun f -> List.iter f lst) end @@ -214,6 +287,7 @@ module Make (F : Foreign) (D : Desc) = struct include Core (F) (D) let bytes_opad = By.make block_size '\x5c' + let bytes_ipad = By.make block_size '\x36' let rec norm_bytes key = @@ -223,6 +297,7 @@ module Make (F : Foreign) (D : Desc) = struct | _ -> By.of_string key let bigstring_opad = Bi.init block_size (fun _ -> '\x5c') + let bigstring_ipad = Bi.init block_size (fun _ -> '\x36') let norm_bigstring key = @@ -236,10 +311,13 @@ module Make (F : Foreign) (D : Desc) = struct let key = norm_bytes (By.unsafe_to_string key) in let outer = Native.XOR.Bytes.xor key bytes_opad in let inner = Native.XOR.Bytes.xor key bytes_ipad in - let res = digesti_bytes (fun f -> f inner ; iter f) in + let res = + digesti_bytes (fun f -> + f inner ; + iter f) in digesti_bytes (fun f -> f outer ; - f (By.unsafe_of_string res) ) + f (By.unsafe_of_string res)) let hmaci_string ~key iter = let key = norm_bytes key in @@ -255,41 +333,42 @@ module Make (F : Foreign) (D : Desc) = struct let key = norm_bigstring key in let outer = Native.XOR.Bigstring.xor key bigstring_opad in let inner = Native.XOR.Bigstring.xor key bigstring_ipad in - let res = digesti_bigstring (fun f -> f inner ; iter f) in + let res = + digesti_bigstring (fun f -> + f inner ; + iter f) in let ctx = feed_bigstring empty outer in feed_string ctx (res :> string) |> get let hmac_bytes ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> By.sub buf off len | Some off, None -> By.sub buf off (By.length buf - off) | None, Some len -> By.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_bytes ~key (fun f -> f buf) let hmac_string ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> String.sub buf off len | Some off, None -> String.sub buf off (String.length buf - off) | None, Some len -> String.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_string ~key (fun f -> f buf) let hmac_bigstring ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> Bi.sub buf off len | Some off, None -> Bi.sub buf off (Bi.length buf - off) | None, Some len -> Bi.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_bigstring ~key (fun f -> f buf) let hmacv_bytes ~key bufs = hmaci_bytes ~key (fun f -> List.iter f bufs) + let hmacv_string ~key bufs = hmaci_string ~key (fun f -> List.iter f bufs) let hmacv_bigstring ~key bufs = @@ -305,44 +384,59 @@ module type Foreign_BLAKE2 = sig module Bigstring : sig val update : ctx -> ba -> int -> int -> unit + val finalize : ctx -> ba -> int -> unit + val with_outlen_and_key : ctx -> int -> ba -> int -> int -> unit end module Bytes : sig val update : ctx -> st -> int -> int -> unit + val finalize : ctx -> st -> int -> unit + val with_outlen_and_key : ctx -> int -> st -> int -> int -> unit end val max_outlen : unit -> int + val ctx_size : unit -> int + val key_size : unit -> int end module Make_BLAKE2 (F : Foreign_BLAKE2) (D : Desc) = struct let () = if D.digest_size > F.max_outlen () - then failwith "Invalid digest_size:%d to make a BLAKE2{S,B} implementation" D.digest_size + then + failwith "Invalid digest_size:%d to make a BLAKE2{S,B} implementation" + D.digest_size + + include Make + (struct + type kind = F.kind + + module Bigstring = struct + let init ctx = + F.Bigstring.with_outlen_and_key ctx D.digest_size Bi.empty 0 0 + + let update = F.Bigstring.update - include Make (struct - type kind = F.kind + let finalize = F.Bigstring.finalize + end - module Bigstring = struct - let init ctx = - F.Bigstring.with_outlen_and_key ctx D.digest_size Bi.empty 0 0 - let update = F.Bigstring.update - let finalize = F.Bigstring.finalize - end + module Bytes = struct + let init ctx = + F.Bytes.with_outlen_and_key ctx D.digest_size By.empty 0 0 - module Bytes = struct - let init ctx = - F.Bytes.with_outlen_and_key ctx D.digest_size By.empty 0 0 - let update = F.Bytes.update - let finalize = F.Bytes.finalize - end + let update = F.Bytes.update - let ctx_size () = F.ctx_size () end) (D) + let finalize = F.Bytes.finalize + end + + let ctx_size () = F.ctx_size () + end) + (D) type outer = t @@ -352,58 +446,56 @@ module Make_BLAKE2 (F : Foreign_BLAKE2) (D : Desc) = struct let key_size = F.key_size () let maci_bytes ~key iter : t = - if By.length key > key_size then - invalid_arg "BLAKE2{S,B}.Keyed.maci_bytes: invalid key" ; + if By.length key > key_size + then invalid_arg "BLAKE2{S,B}.Keyed.maci_bytes: invalid key" ; let ctx = By.create ctx_size in F.Bytes.with_outlen_and_key ctx digest_size key 0 (By.length key) ; feedi_bytes ctx iter |> get let maci_string ~key iter = - if String.length key > key_size then - invalid_arg "BLAKE2{S,B}.Keyed.maci_string: invalid key" ; + if String.length key > key_size + then invalid_arg "BLAKE2{S,B}.Keyed.maci_string: invalid key" ; let ctx = By.create ctx_size in F.Bytes.with_outlen_and_key ctx digest_size (By.unsafe_of_string key) 0 (String.length key) ; feedi_string ctx iter |> get let maci_bigstring ~key iter = - if Bi.length key > key_size then - invalid_arg "BLAKE2{S,B}.Keyed.maci_bigstring: invalid key" ; + if Bi.length key > key_size + then invalid_arg "BLAKE2{S,B}.Keyed.maci_bigstring: invalid key" ; let ctx = By.create ctx_size in F.Bigstring.with_outlen_and_key ctx digest_size key 0 (Bi.length key) ; feedi_bigstring ctx iter |> get let mac_bytes ~key ?off ?len buf : t = let buf = - match off, len with + match (off, len) with | Some off, Some len -> By.sub buf off len | Some off, None -> By.sub buf off (By.length buf - off) | None, Some len -> By.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_bytes ~key (fun f -> f buf) let mac_string ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> String.sub buf off len | Some off, None -> String.sub buf off (String.length buf - off) | None, Some len -> String.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_string ~key (fun f -> f buf) let mac_bigstring ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> Bi.sub buf off len | Some off, None -> Bi.sub buf off (Bi.length buf - off) | None, Some len -> Bi.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_bigstring ~key (fun f -> f buf) let macv_bytes ~key bufs = maci_bytes ~key (fun f -> List.iter f bufs) + let macv_string ~key bufs = maci_string ~key (fun f -> List.iter f bufs) let macv_bigstring ~key bufs = @@ -411,131 +503,133 @@ module Make_BLAKE2 (F : Foreign_BLAKE2) (D : Desc) = struct end end -module MD5 : S with type kind = [`MD5] = +module MD5 : S with type kind = [ `MD5 ] = Make (Native.MD5) (struct - let digest_size, block_size = 16, 64 + let digest_size, block_size = (16, 64) - type kind = [`MD5] + type kind = [ `MD5 ] let kind = `MD5 end) -module SHA1 : S with type kind = [`SHA1] = +module SHA1 : S with type kind = [ `SHA1 ] = Make (Native.SHA1) (struct - let digest_size, block_size = 20, 64 + let digest_size, block_size = (20, 64) - type kind = [`SHA1] + type kind = [ `SHA1 ] let kind = `SHA1 end) -module SHA224 : S with type kind = [`SHA224] = +module SHA224 : S with type kind = [ `SHA224 ] = Make (Native.SHA224) (struct - let digest_size, block_size = 28, 64 + let digest_size, block_size = (28, 64) - type kind = [`SHA224] + type kind = [ `SHA224 ] let kind = `SHA224 end) -module SHA256 : S with type kind = [`SHA256] = +module SHA256 : S with type kind = [ `SHA256 ] = Make (Native.SHA256) (struct - let digest_size, block_size = 32, 64 + let digest_size, block_size = (32, 64) - type kind = [`SHA256] + type kind = [ `SHA256 ] let kind = `SHA256 end) -module SHA384 : S with type kind = [`SHA384] = +module SHA384 : S with type kind = [ `SHA384 ] = Make (Native.SHA384) (struct - let digest_size, block_size = 48, 128 + let digest_size, block_size = (48, 128) - type kind = [`SHA384] + type kind = [ `SHA384 ] let kind = `SHA384 end) -module SHA512 : S with type kind = [`SHA512] = +module SHA512 : S with type kind = [ `SHA512 ] = Make (Native.SHA512) (struct - let digest_size, block_size = 64, 128 + let digest_size, block_size = (64, 128) - type kind = [`SHA512] + type kind = [ `SHA512 ] let kind = `SHA512 end) -module WHIRLPOOL : S with type kind = [`WHIRLPOOL] = +module WHIRLPOOL : S with type kind = [ `WHIRLPOOL ] = Make (Native.WHIRLPOOL) (struct - let digest_size, block_size = 64, 64 + let digest_size, block_size = (64, 64) - type kind = [`WHIRLPOOL] + type kind = [ `WHIRLPOOL ] let kind = `WHIRLPOOL end) module BLAKE2B : sig - include S with type kind = [`BLAKE2B] + include S with type kind = [ `BLAKE2B ] + module Keyed : MAC with type t = t end = Make_BLAKE2 (Native.BLAKE2B) (struct - let digest_size, block_size = 64, 128 + let digest_size, block_size = (64, 128) - type kind = [`BLAKE2B] + type kind = [ `BLAKE2B ] let kind = `BLAKE2B end) module BLAKE2S : sig - include S with type kind = [`BLAKE2S] + include S with type kind = [ `BLAKE2S ] + module Keyed : MAC with type t = t end = Make_BLAKE2 (Native.BLAKE2S) (struct - let digest_size, block_size = 32, 64 + let digest_size, block_size = (32, 64) - type kind = [`BLAKE2S] + type kind = [ `BLAKE2S ] let kind = `BLAKE2S end) -module RMD160 : S with type kind = [`RMD160] = +module RMD160 : S with type kind = [ `RMD160 ] = Make (Native.RMD160) (struct - let digest_size, block_size = 20, 64 + let digest_size, block_size = (20, 64) - type kind = [`RMD160] + type kind = [ `RMD160 ] let kind = `RMD160 end) module Make_BLAKE2B (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2B] = struct +end) : S with type kind = [ `BLAKE2B ] = struct include Make_BLAKE2 (Native.BLAKE2B) (struct - let digest_size, block_size = D.digest_size, 128 + let digest_size, block_size = (D.digest_size, 128) - type kind = [`BLAKE2B] + type kind = [ `BLAKE2B ] let kind = `BLAKE2B end) @@ -543,13 +637,13 @@ end module Make_BLAKE2S (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2S] = struct +end) : S with type kind = [ `BLAKE2S ] = struct include Make_BLAKE2 (Native.BLAKE2S) (struct - let digest_size, block_size = D.digest_size, 64 + let digest_size, block_size = (D.digest_size, 64) - type kind = [`BLAKE2S] + type kind = [ `BLAKE2S ] let kind = `BLAKE2S end) @@ -557,8 +651,9 @@ end include Hash -type blake2b = (module S with type kind = [`BLAKE2B]) -type blake2s = (module S with type kind = [`BLAKE2S]) +type blake2b = (module S with type kind = [ `BLAKE2B ]) + +type blake2s = (module S with type kind = [ `BLAKE2S ]) let module_of : type k. k hash -> (module S with type kind = k) = fun hash -> @@ -574,29 +669,27 @@ let module_of : type k. k hash -> (module S with type kind = k) = | SHA512 -> (module SHA512) | WHIRLPOOL -> (module WHIRLPOOL) | BLAKE2B digest_size -> ( - match Hashtbl.find b2b digest_size with - | exception Not_found -> - let m : (module S with type kind = [`BLAKE2B]) = - (module Make_BLAKE2B (struct let digest_size = digest_size - end) - : S - with type kind = [`BLAKE2B] ) - in - Hashtbl.replace b2b digest_size m ; - m - | m -> m ) - | BLAKE2S digest_size -> ( - match Hashtbl.find b2s digest_size with - | exception Not_found -> - let m = - (module Make_BLAKE2S (struct let digest_size = digest_size - end) - : S - with type kind = [`BLAKE2S] ) - in - Hashtbl.replace b2s digest_size m ; - m - | m -> m ) + match Hashtbl.find b2b digest_size with + | exception Not_found -> + let m : (module S with type kind = [ `BLAKE2B ]) = + (module Make_BLAKE2B (struct + let digest_size = digest_size + end) : S + with type kind = [ `BLAKE2B ]) in + Hashtbl.replace b2b digest_size m ; + m + | m -> m) + | BLAKE2S digest_size -> + match Hashtbl.find b2s digest_size with + | exception Not_found -> + let m = + (module Make_BLAKE2S (struct + let digest_size = digest_size + end) : S + with type kind = [ `BLAKE2S ]) in + Hashtbl.replace b2s digest_size m ; + m + | m -> m type 'kind t = string @@ -640,8 +733,7 @@ let hmaci_string : type k. k hash -> key:String.t -> String.t iter -> k t = let module H = (val module_of hash) in (H.to_raw_string (H.hmaci_string ~key iter) : H.kind t) -let hmaci_bigstring : type k. k hash -> key:bigstring -> bigstring iter -> k t - = +let hmaci_bigstring : type k. k hash -> key:bigstring -> bigstring iter -> k t = fun hash ~key iter -> let module H = (val module_of hash) in (H.to_raw_string (H.hmaci_bigstring ~key iter) : H.kind t) @@ -713,17 +805,24 @@ let of_raw_string_opt : type k. k hash -> string -> k t option = let to_raw_string : type k. k hash -> k t -> string = fun _ t -> t let of_digest (type hash kind) - (module H : S with type t = hash and type kind = kind) (hash : H.t) : - kind t = + (module H : S with type t = hash and type kind = kind) (hash : H.t) : kind t + = H.to_raw_string hash let of_md5 hash = of_raw_string md5 (MD5.to_raw_string hash) + let of_sha1 hash = of_raw_string sha1 (SHA1.to_raw_string hash) + let of_rmd160 hash = of_raw_string rmd160 (RMD160.to_raw_string hash) + let of_sha224 hash = of_raw_string sha224 (SHA224.to_raw_string hash) + let of_sha256 hash = of_raw_string sha256 (SHA256.to_raw_string hash) + let of_sha384 hash = of_raw_string sha384 (SHA384.to_raw_string hash) + let of_sha512 hash = of_raw_string sha512 (SHA512.to_raw_string hash) + let of_whirlpool hash = of_raw_string whirlpool (WHIRLPOOL.to_raw_string hash) let of_blake2b hash = diff --git a/src-c/digestif_native.ml b/src-c/digestif_native.ml index 8860c3d..b7db8b9 100644 --- a/src-c/digestif_native.ml +++ b/src-c/digestif_native.ml @@ -16,25 +16,27 @@ module By = Digestif_by module Bi = Digestif_bi type off = int + type size = int + type ba = Bi.t + type st = By.t + type ctx = By.t let dup : ctx -> ctx = By.copy module MD5 = struct - type kind = [`MD5] + type kind = [ `MD5 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_md5_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_md5_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_md5_ba_finalize" [@@noalloc] end @@ -42,13 +44,11 @@ module MD5 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_md5_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_md5_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_md5_st_finalize" [@@noalloc] end @@ -57,17 +57,15 @@ module MD5 = struct end module SHA1 = struct - type kind = [`SHA1] + type kind = [ `SHA1 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_sha1_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_sha1_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_sha1_ba_finalize" [@@noalloc] end @@ -75,13 +73,11 @@ module SHA1 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_sha1_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_sha1_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_sha1_st_finalize" [@@noalloc] end @@ -90,17 +86,15 @@ module SHA1 = struct end module SHA224 = struct - type kind = [`SHA224] + type kind = [ `SHA224 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_sha224_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_sha224_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_sha224_ba_finalize" [@@noalloc] end @@ -108,13 +102,11 @@ module SHA224 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_sha224_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_sha224_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_sha224_st_finalize" [@@noalloc] end @@ -123,17 +115,15 @@ module SHA224 = struct end module SHA256 = struct - type kind = [`SHA256] + type kind = [ `SHA256 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_sha256_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_sha256_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_sha256_ba_finalize" [@@noalloc] end @@ -141,13 +131,11 @@ module SHA256 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_sha256_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_sha256_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_sha256_st_finalize" [@@noalloc] end @@ -156,17 +144,15 @@ module SHA256 = struct end module SHA384 = struct - type kind = [`SHA384] + type kind = [ `SHA384 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_sha384_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_sha384_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_sha384_ba_finalize" [@@noalloc] end @@ -174,13 +160,11 @@ module SHA384 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_sha384_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_sha384_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_sha384_st_finalize" [@@noalloc] end @@ -189,17 +173,15 @@ module SHA384 = struct end module SHA512 = struct - type kind = [`SHA512] + type kind = [ `SHA512 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_sha512_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_sha512_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_sha512_ba_finalize" [@@noalloc] end @@ -207,13 +189,11 @@ module SHA512 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_sha512_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_sha512_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_sha512_st_finalize" [@@noalloc] end @@ -222,17 +202,15 @@ module SHA512 = struct end module WHIRLPOOL = struct - type kind = [`WHIRLPOOL] + type kind = [ `WHIRLPOOL ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_whirlpool_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_whirlpool_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_whirlpool_ba_finalize" [@@noalloc] end @@ -240,37 +218,33 @@ module WHIRLPOOL = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_whirlpool_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_whirlpool_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_whirlpool_st_finalize" [@@noalloc] end - external ctx_size : unit -> int = "caml_digestif_whirlpool_ctx_size" [@@noalloc] + external ctx_size : unit -> int = "caml_digestif_whirlpool_ctx_size" + [@@noalloc] end module BLAKE2B = struct - type kind = [`BLAKE2B] + type kind = [ `BLAKE2B ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_blake2b_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_blake2b_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_blake2b_ba_finalize" [@@noalloc] - external with_outlen_and_key : - ctx -> size -> ba -> off -> size -> unit + external with_outlen_and_key : ctx -> size -> ba -> off -> size -> unit = "caml_digestif_blake2b_ba_init_with_outlen_and_key" [@@noalloc] end @@ -278,27 +252,22 @@ module BLAKE2B = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_blake2b_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_blake2b_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_blake2b_st_finalize" [@@noalloc] - external with_outlen_and_key : - ctx -> size -> st -> off -> size -> unit + external with_outlen_and_key : ctx -> size -> st -> off -> size -> unit = "caml_digestif_blake2b_st_init_with_outlen_and_key" [@@noalloc] end - external ctx_size : unit -> int = "caml_digestif_blake2b_ctx_size" - [@@noalloc] + external ctx_size : unit -> int = "caml_digestif_blake2b_ctx_size" [@@noalloc] - external key_size : unit -> int = "caml_digestif_blake2b_key_size" - [@@noalloc] + external key_size : unit -> int = "caml_digestif_blake2b_key_size" [@@noalloc] external max_outlen : unit -> int = "caml_digestif_blake2b_max_outlen" [@@noalloc] @@ -308,22 +277,19 @@ module BLAKE2B = struct end module BLAKE2S = struct - type kind = [`BLAKE2S] + type kind = [ `BLAKE2S ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_blake2s_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_blake2s_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_blake2s_ba_finalize" [@@noalloc] - external with_outlen_and_key : - ctx -> size -> ba -> off -> size -> unit + external with_outlen_and_key : ctx -> size -> ba -> off -> size -> unit = "caml_digestif_blake2s_ba_init_with_outlen_and_key" [@@noalloc] end @@ -331,27 +297,22 @@ module BLAKE2S = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_blake2s_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_blake2s_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_blake2s_st_finalize" [@@noalloc] - external with_outlen_and_key : - ctx -> size -> st -> off -> size -> unit + external with_outlen_and_key : ctx -> size -> st -> off -> size -> unit = "caml_digestif_blake2s_st_init_with_outlen_and_key" [@@noalloc] end - external ctx_size : unit -> int = "caml_digestif_blake2s_ctx_size" - [@@noalloc] + external ctx_size : unit -> int = "caml_digestif_blake2s_ctx_size" [@@noalloc] - external key_size : unit -> int = "caml_digestif_blake2s_key_size" - [@@noalloc] + external key_size : unit -> int = "caml_digestif_blake2s_key_size" [@@noalloc] external max_outlen : unit -> int = "caml_digestif_blake2s_max_outlen" [@@noalloc] @@ -361,17 +322,15 @@ module BLAKE2S = struct end module RMD160 = struct - type kind = [`RMD160] + type kind = [ `RMD160 ] module Bigstring = struct external init : ctx -> unit = "caml_digestif_rmd160_ba_init" [@@noalloc] - external update : - ctx -> ba -> off -> size -> unit + external update : ctx -> ba -> off -> size -> unit = "caml_digestif_rmd160_ba_update" - external finalize : - ctx -> ba -> off -> unit + external finalize : ctx -> ba -> off -> unit = "caml_digestif_rmd160_ba_finalize" [@@noalloc] end @@ -379,13 +338,11 @@ module RMD160 = struct module Bytes = struct external init : ctx -> unit = "caml_digestif_rmd160_st_init" [@@noalloc] - external update : - ctx -> st -> off -> size -> unit + external update : ctx -> st -> off -> size -> unit = "caml_digestif_rmd160_st_update" [@@noalloc] - external finalize : - ctx -> st -> off -> unit + external finalize : ctx -> st -> off -> unit = "caml_digestif_rmd160_st_finalize" [@@noalloc] end @@ -397,36 +354,38 @@ let imin (a : int) (b : int) = if a < b then a else b module XOR = struct module Bigstring = struct - external xor_into : - ba -> off -> ba -> off -> size -> unit + external xor_into : ba -> off -> ba -> off -> size -> unit = "caml_digestif_ba_xor_into" [@@noalloc] let xor_into a b n = - if n > imin (Bi.length a) (Bi.length b) then + if n > imin (Bi.length a) (Bi.length b) + then raise (Invalid_argument "Native.Bigstring.xor_into: buffers to small") else xor_into a 0 b 0 n let xor a b = let l = imin (Bi.length a) (Bi.length b) in let r = Bi.copy (Bi.sub b 0 l) in - xor_into a r l ; r + xor_into a r l ; + r end module Bytes = struct - external xor_into : - st -> off -> st -> off -> size -> unit + external xor_into : st -> off -> st -> off -> size -> unit = "caml_digestif_st_xor_into" [@@noalloc] let xor_into a b n = - if n > imin (By.length a) (By.length b) then + if n > imin (By.length a) (By.length b) + then raise (Invalid_argument "Native.Bigstring.xor_into: buffers to small") else xor_into a 0 b 0 n let xor a b = let l = imin (By.length a) (By.length b) in let r = By.copy (By.sub b 0 l) in - xor_into a r l ; r + xor_into a r l ; + r end end diff --git a/src-ocaml/baijiu_blake2b.ml b/src-ocaml/baijiu_blake2b.ml index d93414b..29c605f 100644 --- a/src-ocaml/baijiu_blake2b.ml +++ b/src-ocaml/baijiu_blake2b.ml @@ -7,14 +7,23 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let ( asr ) = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let lnot = Int32.lognot + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor (a asr (32 - n)) + let ror32 a n = (a asr n) lor (a lsl (32 - n)) end @@ -22,155 +31,186 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left + let ( lsr ) = Int64.shift_right + let ( lor ) = Int64.logor + let ( asr ) = Int64.shift_right_logical + let ( lxor ) = Int64.logxor + let ( + ) = Int64.add + let rol64 a n = (a lsl n) lor (a asr (64 - n)) + let ror64 a n = (a asr n) lor (a lsl (64 - n)) end module type S = sig type ctx - type kind = [`BLAKE2B] + + type kind = [ `BLAKE2B ] val init : unit -> ctx + val with_outlen_and_bytes_key : int -> By.t -> int -> int -> ctx + val with_outlen_and_bigstring_key : int -> Bi.t -> int -> int -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx + val max_outlen : int end module Unsafe : S = struct - type kind = [`BLAKE2B] - - type param = - { digest_length: int - ; key_length: int - ; fanout: int - ; depth: int - ; leaf_length: int32 - ; node_offset: int32 - ; xof_length: int32 - ; node_depth: int - ; inner_length: int - ; reserved: int array - ; salt: int array - ; personal: int array } - - type ctx = - { mutable buflen: int - ; outlen: int - ; mutable last_node: int - ; buf: Bytes.t - ; h: int64 array - ; t: int64 array - ; f: int64 array } + type kind = [ `BLAKE2B ] + + type param = { + digest_length : int; + key_length : int; + fanout : int; + depth : int; + leaf_length : int32; + node_offset : int32; + xof_length : int32; + node_depth : int; + inner_length : int; + reserved : int array; + salt : int array; + personal : int array; + } + + type ctx = { + mutable buflen : int; + outlen : int; + mutable last_node : int; + buf : Bytes.t; + h : int64 array; + t : int64 array; + f : int64 array; + } let dup ctx = - { buflen= ctx.buflen - ; outlen= ctx.outlen - ; last_node= ctx.last_node - ; buf= By.copy ctx.buf - ; h= Array.copy ctx.h - ; t= Array.copy ctx.t - ; f= Array.copy ctx.f } + { + buflen = ctx.buflen; + outlen = ctx.outlen; + last_node = ctx.last_node; + buf = By.copy ctx.buf; + h = Array.copy ctx.h; + t = Array.copy ctx.t; + f = Array.copy ctx.f; + } let param_to_bytes param = let arr = - [| param.digest_length land 0xFF - ; param.key_length land 0xFF; param.fanout land 0xFF - ; param.depth land 0xFF (* store to little-endian *) - ; Int32.(to_int ((param.leaf_length lsr 0) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 8) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 16) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 24) land 0xFFl)) - (* store to little-endian *) - ; Int32.(to_int ((param.node_offset lsr 0) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 8) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 16) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 24) land 0xFFl)) - (* store to little-endian *) - ; Int32.(to_int ((param.xof_length lsr 0) land 0xFFl)) - ; Int32.(to_int ((param.xof_length lsr 8) land 0xFFl)) - ; Int32.(to_int ((param.xof_length lsr 16) land 0xFFl)) - ; Int32.(to_int ((param.xof_length lsr 24) land 0xFFl)) - ; param.node_depth land 0xFF - ; param.inner_length land 0xFF - ; param.reserved.(0) land 0xFF - ; param.reserved.(1) land 0xFF - ; param.reserved.(2) land 0xFF - ; param.reserved.(3) land 0xFF - ; param.reserved.(4) land 0xFF - ; param.reserved.(5) land 0xFF - ; param.reserved.(6) land 0xFF - ; param.reserved.(7) land 0xFF - ; param.reserved.(8) land 0xFF - ; param.reserved.(9) land 0xFF - ; param.reserved.(10) land 0xFF - ; param.reserved.(11) land 0xFF - ; param.reserved.(12) land 0xFF - ; param.reserved.(13) land 0xFF - ; param.salt.(0) land 0xFF - ; param.salt.(1) land 0xFF - ; param.salt.(2) land 0xFF - ; param.salt.(3) land 0xFF - ; param.salt.(4) land 0xFF - ; param.salt.(5) land 0xFF - ; param.salt.(6) land 0xFF - ; param.salt.(7) land 0xFF - ; param.salt.(8) land 0xFF - ; param.salt.(9) land 0xFF - ; param.salt.(10) land 0xFF - ; param.salt.(11) land 0xFF - ; param.salt.(12) land 0xFF - ; param.salt.(13) land 0xFF - ; param.salt.(14) land 0xFF - ; param.salt.(15) land 0xFF - ; param.personal.(0) land 0xFF - ; param.personal.(1) land 0xFF - ; param.personal.(2) land 0xFF - ; param.personal.(3) land 0xFF - ; param.personal.(4) land 0xFF - ; param.personal.(5) land 0xFF - ; param.personal.(6) land 0xFF - ; param.personal.(7) land 0xFF - ; param.personal.(8) land 0xFF - ; param.personal.(9) land 0xFF - ; param.personal.(10) land 0xFF - ; param.personal.(11) land 0xFF - ; param.personal.(12) land 0xFF - ; param.personal.(13) land 0xFF - ; param.personal.(14) land 0xFF - ; param.personal.(15) land 0xFF |] - in + [| + param.digest_length land 0xFF; + param.key_length land 0xFF; + param.fanout land 0xFF; + param.depth land 0xFF (* store to little-endian *); + Int32.(to_int ((param.leaf_length lsr 0) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 8) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 16) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 24) land 0xFFl)) + (* store to little-endian *); + Int32.(to_int ((param.node_offset lsr 0) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 8) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 16) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 24) land 0xFFl)) + (* store to little-endian *); + Int32.(to_int ((param.xof_length lsr 0) land 0xFFl)); + Int32.(to_int ((param.xof_length lsr 8) land 0xFFl)); + Int32.(to_int ((param.xof_length lsr 16) land 0xFFl)); + Int32.(to_int ((param.xof_length lsr 24) land 0xFFl)); + param.node_depth land 0xFF; + param.inner_length land 0xFF; + param.reserved.(0) land 0xFF; + param.reserved.(1) land 0xFF; + param.reserved.(2) land 0xFF; + param.reserved.(3) land 0xFF; + param.reserved.(4) land 0xFF; + param.reserved.(5) land 0xFF; + param.reserved.(6) land 0xFF; + param.reserved.(7) land 0xFF; + param.reserved.(8) land 0xFF; + param.reserved.(9) land 0xFF; + param.reserved.(10) land 0xFF; + param.reserved.(11) land 0xFF; + param.reserved.(12) land 0xFF; + param.reserved.(13) land 0xFF; + param.salt.(0) land 0xFF; + param.salt.(1) land 0xFF; + param.salt.(2) land 0xFF; + param.salt.(3) land 0xFF; + param.salt.(4) land 0xFF; + param.salt.(5) land 0xFF; + param.salt.(6) land 0xFF; + param.salt.(7) land 0xFF; + param.salt.(8) land 0xFF; + param.salt.(9) land 0xFF; + param.salt.(10) land 0xFF; + param.salt.(11) land 0xFF; + param.salt.(12) land 0xFF; + param.salt.(13) land 0xFF; + param.salt.(14) land 0xFF; + param.salt.(15) land 0xFF; + param.personal.(0) land 0xFF; + param.personal.(1) land 0xFF; + param.personal.(2) land 0xFF; + param.personal.(3) land 0xFF; + param.personal.(4) land 0xFF; + param.personal.(5) land 0xFF; + param.personal.(6) land 0xFF; + param.personal.(7) land 0xFF; + param.personal.(8) land 0xFF; + param.personal.(9) land 0xFF; + param.personal.(10) land 0xFF; + param.personal.(11) land 0xFF; + param.personal.(12) land 0xFF; + param.personal.(13) land 0xFF; + param.personal.(14) land 0xFF; + param.personal.(15) land 0xFF; + |] in By.init 64 (fun i -> Char.unsafe_chr arr.(i)) let max_outlen = 64 let default_param = - { digest_length= max_outlen - ; key_length= 0 - ; fanout= 1 - ; depth= 1 - ; leaf_length= 0l - ; node_offset= 0l - ; xof_length= 0l - ; node_depth= 0 - ; inner_length= 0 - ; reserved= [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|] - ; salt= [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|] - ; personal= [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|] } + { + digest_length = max_outlen; + key_length = 0; + fanout = 1; + depth = 1; + leaf_length = 0l; + node_offset = 0l; + xof_length = 0l; + node_depth = 0; + inner_length = 0; + reserved = [| 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0 |]; + salt = [| 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0 |]; + personal = [| 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0 |]; + } let iv = - [| 0x6a09e667f3bcc908L; 0xbb67ae8584caa73bL; 0x3c6ef372fe94f82bL - ; 0xa54ff53a5f1d36f1L; 0x510e527fade682d1L; 0x9b05688c2b3e6c1fL - ; 0x1f83d9abfb41bd6bL; 0x5be0cd19137e2179L |] + [| + 0x6a09e667f3bcc908L; + 0xbb67ae8584caa73bL; + 0x3c6ef372fe94f82bL; + 0xa54ff53a5f1d36f1L; + 0x510e527fade682d1L; + 0x9b05688c2b3e6c1fL; + 0x1f83d9abfb41bd6bL; + 0x5be0cd19137e2179L; + |] let increment_counter ctx inc = let open Int64 in @@ -187,14 +227,15 @@ module Unsafe : S = struct let buf = By.make 128 '\x00' in By.fill buf 0 128 '\x00' ; let ctx = - { buflen= 0 - ; outlen= default_param.digest_length - ; last_node= 0 - ; buf - ; h= Array.make 8 0L - ; t= Array.make 2 0L - ; f= Array.make 2 0L } - in + { + buflen = 0; + outlen = default_param.digest_length; + last_node = 0; + buf; + h = Array.make 8 0L; + t = Array.make 2 0L; + f = Array.make 2 0L; + } in let param_bytes = param_to_bytes default_param in for i = 0 to 7 do ctx.h.(i) <- Int64.(iv.(i) lxor By.le64_to_cpu param_bytes (i * 8)) @@ -202,21 +243,23 @@ module Unsafe : S = struct ctx let sigma = - [| [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15|] - ; [|14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3|] - ; [|11; 8; 12; 0; 5; 2; 15; 13; 10; 14; 3; 6; 7; 1; 9; 4|] - ; [|7; 9; 3; 1; 13; 12; 11; 14; 2; 6; 5; 10; 4; 0; 15; 8|] - ; [|9; 0; 5; 7; 2; 4; 10; 15; 14; 1; 11; 12; 6; 8; 3; 13|] - ; [|2; 12; 6; 10; 0; 11; 8; 3; 4; 13; 7; 5; 15; 14; 1; 9|] - ; [|12; 5; 1; 15; 14; 13; 4; 10; 0; 7; 6; 3; 9; 2; 8; 11|] - ; [|13; 11; 7; 14; 12; 1; 3; 9; 5; 0; 15; 4; 8; 6; 2; 10|] - ; [|6; 15; 14; 9; 11; 3; 0; 8; 12; 2; 13; 7; 1; 4; 10; 5|] - ; [|10; 2; 8; 4; 7; 6; 1; 5; 15; 11; 9; 14; 3; 12; 13; 0|] - ; [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15|] - ; [|14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3|] |] - - let compress : type a. - le64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = + [| + [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15 |]; + [| 14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3 |]; + [| 11; 8; 12; 0; 5; 2; 15; 13; 10; 14; 3; 6; 7; 1; 9; 4 |]; + [| 7; 9; 3; 1; 13; 12; 11; 14; 2; 6; 5; 10; 4; 0; 15; 8 |]; + [| 9; 0; 5; 7; 2; 4; 10; 15; 14; 1; 11; 12; 6; 8; 3; 13 |]; + [| 2; 12; 6; 10; 0; 11; 8; 3; 4; 13; 7; 5; 15; 14; 1; 9 |]; + [| 12; 5; 1; 15; 14; 13; 4; 10; 0; 7; 6; 3; 9; 2; 8; 11 |]; + [| 13; 11; 7; 14; 12; 1; 3; 9; 5; 0; 15; 4; 8; 6; 2; 10 |]; + [| 6; 15; 14; 9; 11; 3; 0; 8; 12; 2; 13; 7; 1; 4; 10; 5 |]; + [| 10; 2; 8; 4; 7; 6; 1; 5; 15; 11; 9; 14; 3; 12; 13; 0 |]; + [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15 |]; + [| 14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3 |]; + |] + + let compress : + type a. le64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = fun ~le64_to_cpu ctx block off -> let v = Array.make 16 0L in let m = Array.make 16 0L in @@ -230,8 +273,7 @@ module Unsafe : S = struct v.(a_idx) <- v.(a_idx) + v.(b_idx) + m.(sigma.(r).((2 * i) ++ 1)) ; v.(d_idx) <- ror64 (v.(d_idx) lxor v.(a_idx)) 16 ; v.(c_idx) <- v.(c_idx) + v.(d_idx) ; - v.(b_idx) <- ror64 (v.(b_idx) lxor v.(c_idx)) 63 - in + v.(b_idx) <- ror64 (v.(b_idx) lxor v.(c_idx)) 63 in let r r = g r 0 0 4 8 12 ; g r 1 1 5 9 13 ; @@ -240,8 +282,7 @@ module Unsafe : S = struct g r 4 0 5 10 15 ; g r 5 1 6 11 12 ; g r 6 2 7 8 13 ; - g r 7 3 4 9 14 - in + g r 7 3 4 9 14 in for i = 0 to 15 do m.(i) <- le64_to_cpu block (off + (i * 8)) done ; @@ -274,21 +315,24 @@ module Unsafe : S = struct done ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> le64_to_cpu:(a -> int -> int64) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + le64_to_cpu:(a -> int -> int64) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~le64_to_cpu ctx buf off len -> let in_off = ref off in let in_len = ref len in - if !in_len > 0 then ( + if !in_len > 0 + then ( let left = ctx.buflen in let fill = 128 - left in - if !in_len > fill then ( + if !in_len > fill + then ( ctx.buflen <- 0 ; blit buf !in_off ctx.buf left fill ; increment_counter ctx 128L ; @@ -300,9 +344,9 @@ module Unsafe : S = struct compress ~le64_to_cpu ctx buf !in_off ; in_off := !in_off + 128 ; in_len := !in_len - 128 - done ) ; + done) ; blit buf !in_off ctx.buf ctx.buflen !in_len ; - ctx.buflen <- ctx.buflen + !in_len ) ; + ctx.buflen <- ctx.buflen + !in_len) ; () let unsafe_feed_bytes = feed ~blit:By.blit ~le64_to_cpu:By.le64_to_cpu @@ -311,27 +355,32 @@ module Unsafe : S = struct feed ~blit:By.blit_from_bigstring ~le64_to_cpu:Bi.le64_to_cpu let with_outlen_and_key ~blit outlen key off len = - if outlen > max_outlen then failwith "out length can not be upper than %d (out length: %d)" max_outlen outlen ; + if outlen > max_outlen + then + failwith "out length can not be upper than %d (out length: %d)" max_outlen + outlen ; let buf = By.make 128 '\x00' in let ctx = - { buflen= 0 - ; outlen - ; last_node= 0 - ; buf - ; h= Array.make 8 0L - ; t= Array.make 2 0L - ; f= Array.make 2 0L } - in + { + buflen = 0; + outlen; + last_node = 0; + buf; + h = Array.make 8 0L; + t = Array.make 2 0L; + f = Array.make 2 0L; + } in let param_bytes = - param_to_bytes {default_param with digest_length= outlen; key_length= len} - in + param_to_bytes + { default_param with digest_length = outlen; key_length = len } in for i = 0 to 7 do ctx.h.(i) <- Int64.(iv.(i) lxor By.le64_to_cpu param_bytes (i * 8)) done ; - if len > 0 then ( + if len > 0 + then ( let block = By.make 128 '\x00' in blit key off block 0 len ; - unsafe_feed_bytes ctx block 0 128 ) ; + unsafe_feed_bytes ctx block 0 128) ; ctx let with_outlen_and_bytes_key outlen key off len = @@ -352,7 +401,8 @@ module Unsafe : S = struct if ctx.outlen < default_param.digest_length then By.sub res 0 ctx.outlen else if ctx.outlen > default_param.digest_length - then assert false - (* XXX(dinosaure): [ctx] can not be initialized with [outlen > digest_length = max_outlen]. *) + then + assert false + (* XXX(dinosaure): [ctx] can not be initialized with [outlen > digest_length = max_outlen]. *) else res end diff --git a/src-ocaml/baijiu_blake2s.ml b/src-ocaml/baijiu_blake2s.ml index c724608..dc20a58 100644 --- a/src-ocaml/baijiu_blake2s.ml +++ b/src-ocaml/baijiu_blake2s.ml @@ -7,14 +7,23 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let ( asr ) = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let lnot = Int32.lognot + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor (a asr (32 - n)) + let ror32 a n = (a asr n) lor (a lsl (32 - n)) end @@ -22,120 +31,152 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left + let ( lsr ) = Int64.shift_right + let ( lor ) = Int64.logor + let ( asr ) = Int64.shift_right_logical + let ( lxor ) = Int64.logxor + let ( + ) = Int64.add + let rol64 a n = (a lsl n) lor (a asr (64 - n)) + let ror64 a n = (a asr n) lor (a lsl (64 - n)) end module type S = sig type ctx - type kind = [`BLAKE2S] + + type kind = [ `BLAKE2S ] val init : unit -> ctx + val with_outlen_and_bytes_key : int -> By.t -> int -> int -> ctx + val with_outlen_and_bigstring_key : int -> Bi.t -> int -> int -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx + val max_outlen : int end module Unsafe : S = struct - type kind = [`BLAKE2S] - - type param = - { digest_length: int - ; key_length: int - ; fanout: int - ; depth: int - ; leaf_length: int32 - ; node_offset: int32 - ; xof_length: int - ; node_depth: int - ; inner_length: int - ; salt: int array - ; personal: int array } - - type ctx = - { mutable buflen: int - ; outlen: int - ; mutable last_node: int - ; buf: Bytes.t - ; h: int32 array - ; t: int32 array - ; f: int32 array } + type kind = [ `BLAKE2S ] + + type param = { + digest_length : int; + key_length : int; + fanout : int; + depth : int; + leaf_length : int32; + node_offset : int32; + xof_length : int; + node_depth : int; + inner_length : int; + salt : int array; + personal : int array; + } + + type ctx = { + mutable buflen : int; + outlen : int; + mutable last_node : int; + buf : Bytes.t; + h : int32 array; + t : int32 array; + f : int32 array; + } let dup ctx = - { buflen= ctx.buflen - ; outlen= ctx.outlen - ; last_node= ctx.last_node - ; buf= By.copy ctx.buf - ; h= Array.copy ctx.h - ; t= Array.copy ctx.t - ; f= Array.copy ctx.f } + { + buflen = ctx.buflen; + outlen = ctx.outlen; + last_node = ctx.last_node; + buf = By.copy ctx.buf; + h = Array.copy ctx.h; + t = Array.copy ctx.t; + f = Array.copy ctx.f; + } let param_to_bytes param = let arr = - [| param.digest_length land 0xFF - ; param.key_length land 0xFF; param.fanout land 0xFF - ; param.depth land 0xFF (* store to little-endian *) - ; Int32.(to_int ((param.leaf_length lsr 0) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 8) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 16) land 0xFFl)) - ; Int32.(to_int ((param.leaf_length lsr 24) land 0xFFl)) - (* store to little-endian *) - ; Int32.(to_int ((param.node_offset lsr 0) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 8) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 16) land 0xFFl)) - ; Int32.(to_int ((param.node_offset lsr 24) land 0xFFl)) - (* store to little-endian *) - ; (param.xof_length lsr 0) land 0xFF - ; (param.xof_length lsr 8) land 0xFF - ; param.node_depth land 0xFF - ; param.inner_length land 0xFF - ; param.salt.(0) land 0xFF - ; param.salt.(1) land 0xFF - ; param.salt.(2) land 0xFF - ; param.salt.(3) land 0xFF - ; param.salt.(4) land 0xFF - ; param.salt.(5) land 0xFF - ; param.salt.(6) land 0xFF - ; param.salt.(7) land 0xFF - ; param.personal.(0) land 0xFF - ; param.personal.(1) land 0xFF - ; param.personal.(2) land 0xFF - ; param.personal.(3) land 0xFF - ; param.personal.(4) land 0xFF - ; param.personal.(5) land 0xFF - ; param.personal.(6) land 0xFF - ; param.personal.(7) land 0xFF |] - in + [| + param.digest_length land 0xFF; + param.key_length land 0xFF; + param.fanout land 0xFF; + param.depth land 0xFF (* store to little-endian *); + Int32.(to_int ((param.leaf_length lsr 0) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 8) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 16) land 0xFFl)); + Int32.(to_int ((param.leaf_length lsr 24) land 0xFFl)) + (* store to little-endian *); + Int32.(to_int ((param.node_offset lsr 0) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 8) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 16) land 0xFFl)); + Int32.(to_int ((param.node_offset lsr 24) land 0xFFl)) + (* store to little-endian *); + (param.xof_length lsr 0) land 0xFF; + (param.xof_length lsr 8) land 0xFF; + param.node_depth land 0xFF; + param.inner_length land 0xFF; + param.salt.(0) land 0xFF; + param.salt.(1) land 0xFF; + param.salt.(2) land 0xFF; + param.salt.(3) land 0xFF; + param.salt.(4) land 0xFF; + param.salt.(5) land 0xFF; + param.salt.(6) land 0xFF; + param.salt.(7) land 0xFF; + param.personal.(0) land 0xFF; + param.personal.(1) land 0xFF; + param.personal.(2) land 0xFF; + param.personal.(3) land 0xFF; + param.personal.(4) land 0xFF; + param.personal.(5) land 0xFF; + param.personal.(6) land 0xFF; + param.personal.(7) land 0xFF; + |] in By.init 32 (fun i -> Char.unsafe_chr arr.(i)) let max_outlen = 32 let default_param = - { digest_length= max_outlen - ; key_length= 0 - ; fanout= 1 - ; depth= 1 - ; leaf_length= 0l - ; node_offset= 0l - ; xof_length= 0 - ; node_depth= 0 - ; inner_length= 0 - ; salt= [|0; 0; 0; 0; 0; 0; 0; 0|] - ; personal= [|0; 0; 0; 0; 0; 0; 0; 0|] } + { + digest_length = max_outlen; + key_length = 0; + fanout = 1; + depth = 1; + leaf_length = 0l; + node_offset = 0l; + xof_length = 0; + node_depth = 0; + inner_length = 0; + salt = [| 0; 0; 0; 0; 0; 0; 0; 0 |]; + personal = [| 0; 0; 0; 0; 0; 0; 0; 0 |]; + } let iv = - [| 0x6A09E667l; 0xBB67AE85l; 0x3C6EF372l; 0xA54FF53Al; 0x510E527Fl - ; 0x9B05688Cl; 0x1F83D9ABl; 0x5BE0CD19l |] + [| + 0x6A09E667l; + 0xBB67AE85l; + 0x3C6EF372l; + 0xA54FF53Al; + 0x510E527Fl; + 0x9B05688Cl; + 0x1F83D9ABl; + 0x5BE0CD19l; + |] let increment_counter ctx inc = let open Int32 in @@ -151,14 +192,15 @@ module Unsafe : S = struct let init () = let buf = By.make 64 '\x00' in let ctx = - { buflen= 0 - ; outlen= default_param.digest_length - ; last_node= 0 - ; buf - ; h= Array.make 8 0l - ; t= Array.make 2 0l - ; f= Array.make 2 0l } - in + { + buflen = 0; + outlen = default_param.digest_length; + last_node = 0; + buf; + h = Array.make 8 0l; + t = Array.make 2 0l; + f = Array.make 2 0l; + } in let param_bytes = param_to_bytes default_param in for i = 0 to 7 do ctx.h.(i) <- Int32.(iv.(i) lxor By.le32_to_cpu param_bytes (i * 4)) @@ -166,19 +208,21 @@ module Unsafe : S = struct ctx let sigma = - [| [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15|] - ; [|14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3|] - ; [|11; 8; 12; 0; 5; 2; 15; 13; 10; 14; 3; 6; 7; 1; 9; 4|] - ; [|7; 9; 3; 1; 13; 12; 11; 14; 2; 6; 5; 10; 4; 0; 15; 8|] - ; [|9; 0; 5; 7; 2; 4; 10; 15; 14; 1; 11; 12; 6; 8; 3; 13|] - ; [|2; 12; 6; 10; 0; 11; 8; 3; 4; 13; 7; 5; 15; 14; 1; 9|] - ; [|12; 5; 1; 15; 14; 13; 4; 10; 0; 7; 6; 3; 9; 2; 8; 11|] - ; [|13; 11; 7; 14; 12; 1; 3; 9; 5; 0; 15; 4; 8; 6; 2; 10|] - ; [|6; 15; 14; 9; 11; 3; 0; 8; 12; 2; 13; 7; 1; 4; 10; 5|] - ; [|10; 2; 8; 4; 7; 6; 1; 5; 15; 11; 9; 14; 3; 12; 13; 0|] |] - - let compress : type a. - le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = + [| + [| 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15 |]; + [| 14; 10; 4; 8; 9; 15; 13; 6; 1; 12; 0; 2; 11; 7; 5; 3 |]; + [| 11; 8; 12; 0; 5; 2; 15; 13; 10; 14; 3; 6; 7; 1; 9; 4 |]; + [| 7; 9; 3; 1; 13; 12; 11; 14; 2; 6; 5; 10; 4; 0; 15; 8 |]; + [| 9; 0; 5; 7; 2; 4; 10; 15; 14; 1; 11; 12; 6; 8; 3; 13 |]; + [| 2; 12; 6; 10; 0; 11; 8; 3; 4; 13; 7; 5; 15; 14; 1; 9 |]; + [| 12; 5; 1; 15; 14; 13; 4; 10; 0; 7; 6; 3; 9; 2; 8; 11 |]; + [| 13; 11; 7; 14; 12; 1; 3; 9; 5; 0; 15; 4; 8; 6; 2; 10 |]; + [| 6; 15; 14; 9; 11; 3; 0; 8; 12; 2; 13; 7; 1; 4; 10; 5 |]; + [| 10; 2; 8; 4; 7; 6; 1; 5; 15; 11; 9; 14; 3; 12; 13; 0 |]; + |] + + let compress : + type a. le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = fun ~le32_to_cpu ctx block off -> let v = Array.make 16 0l in let m = Array.make 16 0l in @@ -192,8 +236,7 @@ module Unsafe : S = struct v.(a_idx) <- v.(a_idx) + v.(b_idx) + m.(sigma.(r).((2 * i) ++ 1)) ; v.(d_idx) <- ror32 (v.(d_idx) lxor v.(a_idx)) 8 ; v.(c_idx) <- v.(c_idx) + v.(d_idx) ; - v.(b_idx) <- ror32 (v.(b_idx) lxor v.(c_idx)) 7 - in + v.(b_idx) <- ror32 (v.(b_idx) lxor v.(c_idx)) 7 in let r r = g r 0 0 4 8 12 ; g r 1 1 5 9 13 ; @@ -202,8 +245,7 @@ module Unsafe : S = struct g r 4 0 5 10 15 ; g r 5 1 6 11 12 ; g r 6 2 7 8 13 ; - g r 7 3 4 9 14 - in + g r 7 3 4 9 14 in for i = 0 to 15 do m.(i) <- le32_to_cpu block (off + (i * 4)) done ; @@ -234,21 +276,24 @@ module Unsafe : S = struct done ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> le32_to_cpu:(a -> int -> int32) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + le32_to_cpu:(a -> int -> int32) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~le32_to_cpu ctx buf off len -> let in_off = ref off in let in_len = ref len in - if !in_len > 0 then ( + if !in_len > 0 + then ( let left = ctx.buflen in let fill = 64 - left in - if !in_len > fill then ( + if !in_len > fill + then ( ctx.buflen <- 0 ; blit buf !in_off ctx.buf left fill ; increment_counter ctx 64l ; @@ -260,9 +305,9 @@ module Unsafe : S = struct compress ~le32_to_cpu ctx buf !in_off ; in_off := !in_off + 64 ; in_len := !in_len - 64 - done ) ; + done) ; blit buf !in_off ctx.buf ctx.buflen !in_len ; - ctx.buflen <- ctx.buflen + !in_len ) ; + ctx.buflen <- ctx.buflen + !in_len) ; () let unsafe_feed_bytes = feed ~blit:By.blit ~le32_to_cpu:By.le32_to_cpu @@ -271,27 +316,32 @@ module Unsafe : S = struct feed ~blit:By.blit_from_bigstring ~le32_to_cpu:Bi.le32_to_cpu let with_outlen_and_key ~blit outlen key off len = - if outlen > max_outlen then failwith "out length can not be upper than %d (out length: %d)" max_outlen outlen ; + if outlen > max_outlen + then + failwith "out length can not be upper than %d (out length: %d)" max_outlen + outlen ; let buf = By.make 64 '\x00' in let ctx = - { buflen= 0 - ; outlen - ; last_node= 0 - ; buf - ; h= Array.make 8 0l - ; t= Array.make 2 0l - ; f= Array.make 2 0l } - in + { + buflen = 0; + outlen; + last_node = 0; + buf; + h = Array.make 8 0l; + t = Array.make 2 0l; + f = Array.make 2 0l; + } in let param_bytes = - param_to_bytes {default_param with key_length= len; digest_length= outlen} - in + param_to_bytes + { default_param with key_length = len; digest_length = outlen } in for i = 0 to 7 do ctx.h.(i) <- Int32.(iv.(i) lxor By.le32_to_cpu param_bytes (i * 4)) done ; - if len > 0 then ( + if len > 0 + then ( let block = By.make 64 '\x00' in blit key off block 0 len ; - unsafe_feed_bytes ctx block 0 64 ) ; + unsafe_feed_bytes ctx block 0 64) ; ctx let with_outlen_and_bytes_key outlen key off len = @@ -312,7 +362,8 @@ module Unsafe : S = struct if ctx.outlen < default_param.digest_length then By.sub res 0 ctx.outlen else if ctx.outlen > default_param.digest_length - then assert false - (* XXX(dinosaure): [ctx] can not be initialized with [outlen > digest_length = max_outlen]. *) + then + assert false + (* XXX(dinosaure): [ctx] can not be initialized with [outlen > digest_length = max_outlen]. *) else res end diff --git a/src-ocaml/baijiu_md5.ml b/src-ocaml/baijiu_md5.ml index fc2a46e..8ac2590 100644 --- a/src-ocaml/baijiu_md5.ml +++ b/src-ocaml/baijiu_md5.ml @@ -5,14 +5,23 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let srl = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let lnot = Int32.lognot + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor srl a (32 - n) + let ror32 a n = srl a n lor (a lsl (32 - n)) end @@ -20,41 +29,54 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left end module type S = sig - type kind = [`MD5] - type ctx = {mutable size: int64; b: Bytes.t; h: int32 array} + type kind = [ `MD5 ] + + type ctx = { mutable size : int64; b : Bytes.t; h : int32 array } val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`MD5] - type ctx = {mutable size: int64; b: Bytes.t; h: int32 array} + type kind = [ `MD5 ] - let dup ctx = {size= ctx.size; b= By.copy ctx.b; h= Array.copy ctx.h} + type ctx = { mutable size : int64; b : Bytes.t; h : int32 array } + + let dup ctx = { size = ctx.size; b = By.copy ctx.b; h = Array.copy ctx.h } let init () = let b = By.make 64 '\x00' in - {size= 0L; b; h= [|0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l|]} + { + size = 0L; + b; + h = [| 0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l |]; + } let f1 x y z = Int32.(z lxor (x land (y lxor z))) + let f2 x y z = f1 z x y + let f3 x y z = Int32.(x lxor y lxor z) + let f4 x y z = Int32.(y lxor (x lor lnot z)) - let md5_do_chunk : type a. - le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = + let md5_do_chunk : + type a. le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = fun ~le32_to_cpu ctx buf off -> let a, b, c, d = - ref ctx.h.(0), ref ctx.h.(1), ref ctx.h.(2), ref ctx.h.(3) - in + (ref ctx.h.(0), ref ctx.h.(1), ref ctx.h.(2), ref ctx.h.(3)) in let w = Array.make 16 0l in for i = 0 to 15 do w.(i) <- le32_to_cpu buf (off + (i * 4)) @@ -63,8 +85,7 @@ module Unsafe : S = struct let open Int32 in a := !a + f !b !c !d + w.(i) + k ; a := rol32 !a s ; - a := !a + !b - in + a := !a + !b in round f1 a b c d 0 0xd76aa478l 7 ; round f1 d a b c 1 0xe8c7b756l 12 ; round f1 c d a b 2 0x242070dbl 17 ; @@ -136,26 +157,28 @@ module Unsafe : S = struct ctx.h.(3) <- ctx.h.(3) + !d ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> le32_to_cpu:(a -> int -> int32) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + le32_to_cpu:(a -> int -> int32) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~le32_to_cpu ctx buf off len -> let idx = ref Int64.(to_int (ctx.size land 0x3FL)) in let len = ref len in let off = ref off in let to_fill = 64 - !idx in ctx.size <- Int64.add ctx.size (Int64.of_int !len) ; - if !idx <> 0 && !len >= to_fill then ( + if !idx <> 0 && !len >= to_fill + then ( blit buf !off ctx.b !idx to_fill ; md5_do_chunk ~le32_to_cpu:By.le32_to_cpu ctx ctx.b 0 ; len := !len - to_fill ; off := !off + to_fill ; - idx := 0 ) ; + idx := 0) ; while !len >= 64 do md5_do_chunk ~le32_to_cpu ctx buf !off ; len := !len - 64 ; diff --git a/src-ocaml/baijiu_rmd160.ml b/src-ocaml/baijiu_rmd160.ml index 867de68..6cdc4e2 100644 --- a/src-ocaml/baijiu_rmd160.ml +++ b/src-ocaml/baijiu_rmd160.ml @@ -3,12 +3,17 @@ module Bi = Digestif_bi module type S = sig type ctx - type kind = [`RMD160] + + type kind = [ `RMD160 ] val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end @@ -16,14 +21,23 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let srl = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let lnot = Int32.lognot + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor srl a (32 - n) + let ror32 a n = srl a n lor (a lsl (32 - n)) end @@ -31,27 +45,35 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left end module Unsafe : S = struct - type kind = [`RMD160] - type ctx = {s: int32 array; mutable n: int; h: int32 array; b: Bytes.t} + type kind = [ `RMD160 ] + + type ctx = { s : int32 array; mutable n : int; h : int32 array; b : Bytes.t } let dup ctx = - {s= Array.copy ctx.s; n= ctx.n; h= Array.copy ctx.h; b= By.copy ctx.b} + { s = Array.copy ctx.s; n = ctx.n; h = Array.copy ctx.h; b = By.copy ctx.b } let init () = let b = By.make 64 '\x00' in - { s= [|0l; 0l|] - ; n= 0 - ; b - ; h= [|0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l; 0xc3d2e1f0l|] } + { + s = [| 0l; 0l |]; + n = 0; + b; + h = [| 0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l; 0xc3d2e1f0l |]; + } let f x y z = Int32.(x lxor y lxor z) + let g x y z = Int32.(x land y lor (lnot x land z)) + let h x y z = Int32.(x lor lnot y lxor z) + let i x y z = Int32.(x land z lor (y land lnot z)) + let j x y z = Int32.(x lxor (y lor lnot z)) let ff a b c d e x s = @@ -114,21 +136,20 @@ module Unsafe : S = struct a := rol32 !a s + !e ; c := rol32 !c 10 - let rmd160_do_chunk : type a. - le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = + let rmd160_do_chunk : + type a. le32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = fun ~le32_to_cpu ctx buff off -> let aa, bb, cc, dd, ee, aaa, bbb, ccc, ddd, eee = - ( ref ctx.h.(0) - , ref ctx.h.(1) - , ref ctx.h.(2) - , ref ctx.h.(3) - , ref ctx.h.(4) - , ref ctx.h.(0) - , ref ctx.h.(1) - , ref ctx.h.(2) - , ref ctx.h.(3) - , ref ctx.h.(4) ) - in + ( ref ctx.h.(0), + ref ctx.h.(1), + ref ctx.h.(2), + ref ctx.h.(3), + ref ctx.h.(4), + ref ctx.h.(0), + ref ctx.h.(1), + ref ctx.h.(2), + ref ctx.h.(3), + ref ctx.h.(4) ) in let w = Array.make 16 0l in for i = 0 to 15 do w.(i) <- le32_to_cpu buff (off + (i * 4)) @@ -305,14 +326,15 @@ module Unsafe : S = struct exception Leave - let feed : type a. - le32_to_cpu:(a -> int -> int32) - -> blit:(a -> int -> By.t -> int -> int -> unit) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + le32_to_cpu:(a -> int -> int32) -> + blit:(a -> int -> By.t -> int -> int -> unit) -> + ctx -> + a -> + int -> + int -> + unit = fun ~le32_to_cpu ~blit ctx buf off len -> let t = ref ctx.s.(0) in let off = ref off in @@ -321,16 +343,18 @@ module Unsafe : S = struct if ctx.s.(0) < !t then ctx.s.(1) <- Int32.(ctx.s.(1) + 1l) ; ctx.s.(1) <- Int32.add ctx.s.(1) (Int32.of_int (!len lsr 29)) ; try - if ctx.n <> 0 then ( + if ctx.n <> 0 + then ( let t = 64 - ctx.n in - if !len < t then ( + if !len < t + then ( blit buf !off ctx.b ctx.n !len ; ctx.n <- ctx.n + !len ; - raise Leave ) ; + raise Leave) ; blit buf !off ctx.b ctx.n t ; rmd160_do_chunk ~le32_to_cpu:By.le32_to_cpu ctx ctx.b 0 ; off := !off + t ; - len := !len - t ) ; + len := !len - t) ; while !len >= 64 do rmd160_do_chunk ~le32_to_cpu ctx buf !off ; off := !off + 64 ; @@ -351,10 +375,11 @@ module Unsafe : S = struct let i = ref (ctx.n + 1) in let res = By.create (5 * 4) in By.set ctx.b ctx.n '\x80' ; - if !i > 56 then ( + if !i > 56 + then ( By.fill ctx.b !i (64 - !i) '\x00' ; rmd160_do_chunk ~le32_to_cpu:By.le32_to_cpu ctx ctx.b 0 ; - i := 0 ) ; + i := 0) ; By.fill ctx.b !i (56 - !i) '\x00' ; By.cpu_to_le32 ctx.b 56 ctx.s.(0) ; By.cpu_to_le32 ctx.b 60 ctx.s.(1) ; diff --git a/src-ocaml/baijiu_sha1.ml b/src-ocaml/baijiu_sha1.ml index ef78494..9d9341a 100644 --- a/src-ocaml/baijiu_sha1.ml +++ b/src-ocaml/baijiu_sha1.ml @@ -5,12 +5,19 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let srl = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor srl a (32 - n) end @@ -18,43 +25,59 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left end module type S = sig type ctx - type kind = [`SHA1] + + type kind = [ `SHA1 ] val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`SHA1] - type ctx = {mutable size: int64; b: Bytes.t; h: int32 array} + type kind = [ `SHA1 ] + + type ctx = { mutable size : int64; b : Bytes.t; h : int32 array } - let dup ctx = {size= ctx.size; b= By.copy ctx.b; h= Array.copy ctx.h} + let dup ctx = { size = ctx.size; b = By.copy ctx.b; h = Array.copy ctx.h } let init () = let b = By.make 64 '\x00' in - { size= 0L - ; b - ; h= [|0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l; 0xc3d2e1f0l|] } + { + size = 0L; + b; + h = [| 0x67452301l; 0xefcdab89l; 0x98badcfel; 0x10325476l; 0xc3d2e1f0l |]; + } let f1 x y z = Int32.(z lxor (x land (y lxor z))) + let f2 x y z = Int32.(x lxor y lxor z) + let f3 x y z = Int32.((x land y) + (z land (x lxor y))) + let f4 = f2 + let k1 = 0x5a827999l + let k2 = 0x6ed9eba1l + let k3 = 0x8f1bbcdcl + let k4 = 0xca62c1d6l - let sha1_do_chunk : type a. - be32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = + let sha1_do_chunk : + type a. be32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = fun ~be32_to_cpu ctx buf off -> let a = ref ctx.h.(0) in let b = ref ctx.h.(1) in @@ -68,19 +91,16 @@ module Unsafe : S = struct let v = Int32.( rol32 - ( w.(i && 0x0F) + (w.(i && 0x0F) lxor w.((i -- 14) && 0x0F) lxor w.((i -- 8) && 0x0F) - lxor w.((i -- 3) && 0x0F) ) - 1) - in + lxor w.((i -- 3) && 0x0F)) + 1) in w.(i land 0x0F) <- v ; - w.(i land 0x0F) - in + w.(i land 0x0F) in let round a b c d e f k w = (e := Int32.(!e + rol32 !a 5 + f !b !c !d + k + w)) ; - b := Int32.(rol32 !b 30) - in + b := Int32.(rol32 !b 30) in for i = 0 to 15 do w.(i) <- be32_to_cpu buf (off + (i * 4)) done ; @@ -171,26 +191,28 @@ module Unsafe : S = struct ctx.h.(4) <- Int32.add ctx.h.(4) !e ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> be32_to_cpu:(a -> int -> int32) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + be32_to_cpu:(a -> int -> int32) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~be32_to_cpu ctx buf off len -> let idx = ref Int64.(to_int (ctx.size land 0x3FL)) in let len = ref len in let off = ref off in let to_fill = 64 - !idx in ctx.size <- Int64.add ctx.size (Int64.of_int !len) ; - if !idx <> 0 && !len >= to_fill then ( + if !idx <> 0 && !len >= to_fill + then ( blit buf !off ctx.b !idx to_fill ; sha1_do_chunk ~be32_to_cpu:By.be32_to_cpu ctx ctx.b 0 ; len := !len - to_fill ; off := !off + to_fill ; - idx := 0 ) ; + idx := 0) ; while !len >= 64 do sha1_do_chunk ~be32_to_cpu ctx buf !off ; len := !len - 64 ; diff --git a/src-ocaml/baijiu_sha224.ml b/src-ocaml/baijiu_sha224.ml index ce2a11f..b14e6e9 100644 --- a/src-ocaml/baijiu_sha224.ml +++ b/src-ocaml/baijiu_sha224.ml @@ -3,17 +3,22 @@ module Bi = Digestif_bi module type S = sig type ctx - type kind = [`SHA224] + + type kind = [ `SHA224 ] val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`SHA224] + type kind = [ `SHA224 ] open Baijiu_sha256.Unsafe @@ -21,17 +26,29 @@ module Unsafe : S = struct let init () = let b = By.make 128 '\x00' in - { size= 0L - ; b - ; h= - [| 0xc1059ed8l; 0x367cd507l; 0x3070dd17l; 0xf70e5939l; 0xffc00b31l - ; 0x68581511l; 0x64f98fa7l; 0xbefa4fa4l |] } + { + size = 0L; + b; + h = + [| + 0xc1059ed8l; + 0x367cd507l; + 0x3070dd17l; + 0xf70e5939l; + 0xffc00b31l; + 0x68581511l; + 0x64f98fa7l; + 0xbefa4fa4l; + |]; + } let unsafe_get ctx = let res = unsafe_get ctx in By.sub res 0 28 let dup = dup + let unsafe_feed_bytes = unsafe_feed_bytes + let unsafe_feed_bigstring = unsafe_feed_bigstring end diff --git a/src-ocaml/baijiu_sha256.ml b/src-ocaml/baijiu_sha256.ml index 18ab294..4ade19a 100644 --- a/src-ocaml/baijiu_sha256.ml +++ b/src-ocaml/baijiu_sha256.ml @@ -5,13 +5,21 @@ module Int32 = struct include Int32 let ( lsl ) = Int32.shift_left + let ( lsr ) = Int32.shift_right + let srl = Int32.shift_right_logical + let ( lor ) = Int32.logor + let ( lxor ) = Int32.logxor + let ( land ) = Int32.logand + let ( + ) = Int32.add + let rol32 a n = (a lsl n) lor srl a (32 - n) + let ror32 a n = srl a n lor (a lsl (32 - n)) end @@ -19,85 +27,155 @@ module Int64 = struct include Int64 let ( land ) = Int64.logand + let ( lsl ) = Int64.shift_left end module type S = sig - type kind = [`SHA256] - type ctx = {mutable size: int64; b: Bytes.t; h: int32 array} + type kind = [ `SHA256 ] + + type ctx = { mutable size : int64; b : Bytes.t; h : int32 array } val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`SHA256] - type ctx = {mutable size: int64; b: Bytes.t; h: int32 array} + type kind = [ `SHA256 ] - let dup ctx = {size= ctx.size; b= By.copy ctx.b; h= Array.copy ctx.h} + type ctx = { mutable size : int64; b : Bytes.t; h : int32 array } + + let dup ctx = { size = ctx.size; b = By.copy ctx.b; h = Array.copy ctx.h } let init () = let b = By.make 128 '\x00' in - { size= 0L - ; b - ; h= - [| 0x6a09e667l; 0xbb67ae85l; 0x3c6ef372l; 0xa54ff53al; 0x510e527fl - ; 0x9b05688cl; 0x1f83d9abl; 0x5be0cd19l |] } + { + size = 0L; + b; + h = + [| + 0x6a09e667l; + 0xbb67ae85l; + 0x3c6ef372l; + 0xa54ff53al; + 0x510e527fl; + 0x9b05688cl; + 0x1f83d9abl; + 0x5be0cd19l; + |]; + } let k = - [| 0x428a2f98l; 0x71374491l; 0xb5c0fbcfl; 0xe9b5dba5l; 0x3956c25bl - ; 0x59f111f1l; 0x923f82a4l; 0xab1c5ed5l; 0xd807aa98l; 0x12835b01l - ; 0x243185bel; 0x550c7dc3l; 0x72be5d74l; 0x80deb1fel; 0x9bdc06a7l - ; 0xc19bf174l; 0xe49b69c1l; 0xefbe4786l; 0x0fc19dc6l; 0x240ca1ccl - ; 0x2de92c6fl; 0x4a7484aal; 0x5cb0a9dcl; 0x76f988dal; 0x983e5152l - ; 0xa831c66dl; 0xb00327c8l; 0xbf597fc7l; 0xc6e00bf3l; 0xd5a79147l - ; 0x06ca6351l; 0x14292967l; 0x27b70a85l; 0x2e1b2138l; 0x4d2c6dfcl - ; 0x53380d13l; 0x650a7354l; 0x766a0abbl; 0x81c2c92el; 0x92722c85l - ; 0xa2bfe8a1l; 0xa81a664bl; 0xc24b8b70l; 0xc76c51a3l; 0xd192e819l - ; 0xd6990624l; 0xf40e3585l; 0x106aa070l; 0x19a4c116l; 0x1e376c08l - ; 0x2748774cl; 0x34b0bcb5l; 0x391c0cb3l; 0x4ed8aa4al; 0x5b9cca4fl - ; 0x682e6ff3l; 0x748f82eel; 0x78a5636fl; 0x84c87814l; 0x8cc70208l - ; 0x90befffal; 0xa4506cebl; 0xbef9a3f7l; 0xc67178f2l |] + [| + 0x428a2f98l; + 0x71374491l; + 0xb5c0fbcfl; + 0xe9b5dba5l; + 0x3956c25bl; + 0x59f111f1l; + 0x923f82a4l; + 0xab1c5ed5l; + 0xd807aa98l; + 0x12835b01l; + 0x243185bel; + 0x550c7dc3l; + 0x72be5d74l; + 0x80deb1fel; + 0x9bdc06a7l; + 0xc19bf174l; + 0xe49b69c1l; + 0xefbe4786l; + 0x0fc19dc6l; + 0x240ca1ccl; + 0x2de92c6fl; + 0x4a7484aal; + 0x5cb0a9dcl; + 0x76f988dal; + 0x983e5152l; + 0xa831c66dl; + 0xb00327c8l; + 0xbf597fc7l; + 0xc6e00bf3l; + 0xd5a79147l; + 0x06ca6351l; + 0x14292967l; + 0x27b70a85l; + 0x2e1b2138l; + 0x4d2c6dfcl; + 0x53380d13l; + 0x650a7354l; + 0x766a0abbl; + 0x81c2c92el; + 0x92722c85l; + 0xa2bfe8a1l; + 0xa81a664bl; + 0xc24b8b70l; + 0xc76c51a3l; + 0xd192e819l; + 0xd6990624l; + 0xf40e3585l; + 0x106aa070l; + 0x19a4c116l; + 0x1e376c08l; + 0x2748774cl; + 0x34b0bcb5l; + 0x391c0cb3l; + 0x4ed8aa4al; + 0x5b9cca4fl; + 0x682e6ff3l; + 0x748f82eel; + 0x78a5636fl; + 0x84c87814l; + 0x8cc70208l; + 0x90befffal; + 0xa4506cebl; + 0xbef9a3f7l; + 0xc67178f2l; + |] let e0 x = Int32.(ror32 x 2 lxor ror32 x 13 lxor ror32 x 22) + let e1 x = Int32.(ror32 x 6 lxor ror32 x 11 lxor ror32 x 25) + let s0 x = Int32.(ror32 x 7 lxor ror32 x 18 lxor srl x 3) + let s1 x = Int32.(ror32 x 17 lxor ror32 x 19 lxor srl x 10) - let sha256_do_chunk : type a. - be32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = + let sha256_do_chunk : + type a. be32_to_cpu:(a -> int -> int32) -> ctx -> a -> int -> unit = fun ~be32_to_cpu ctx buf off -> let a, b, c, d, e, f, g, h, t1, t2 = - ( ref ctx.h.(0) - , ref ctx.h.(1) - , ref ctx.h.(2) - , ref ctx.h.(3) - , ref ctx.h.(4) - , ref ctx.h.(5) - , ref ctx.h.(6) - , ref ctx.h.(7) - , ref 0l - , ref 0l ) - in + ( ref ctx.h.(0), + ref ctx.h.(1), + ref ctx.h.(2), + ref ctx.h.(3), + ref ctx.h.(4), + ref ctx.h.(5), + ref ctx.h.(6), + ref ctx.h.(7), + ref 0l, + ref 0l ) in let w = Array.make 64 0l in for i = 0 to 15 do w.(i) <- be32_to_cpu buf (off + (i * 4)) done ; let ( -- ) a b = a - b in for i = 16 to 63 do - w.(i) - <- Int32.(s1 w.(i -- 2) + w.(i -- 7) + s0 w.(i -- 15) + w.(i -- 16)) + w.(i) <- Int32.(s1 w.(i -- 2) + w.(i -- 7) + s0 w.(i -- 15) + w.(i -- 16)) done ; let round a b c d e f g h k w = let open Int32 in t1 := !h + e1 !e + (!g lxor (!e land (!f lxor !g))) + k + w ; t2 := e0 !a + (!a land !b lor (!c land (!a lor !b))) ; d := !d + !t1 ; - h := !t1 + !t2 - in + h := !t1 + !t2 in for i = 0 to 7 do round a b c d e f g h k.((i * 8) + 0) w.((i * 8) + 0) ; round h a b c d e f g k.((i * 8) + 1) w.((i * 8) + 1) ; @@ -119,26 +197,28 @@ module Unsafe : S = struct ctx.h.(7) <- ctx.h.(7) + !h ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> be32_to_cpu:(a -> int -> int32) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + be32_to_cpu:(a -> int -> int32) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~be32_to_cpu ctx buf off len -> let idx = ref Int64.(to_int (ctx.size land 0x3FL)) in let len = ref len in let off = ref off in let to_fill = 64 - !idx in ctx.size <- Int64.add ctx.size (Int64.of_int !len) ; - if !idx <> 0 && !len >= to_fill then ( + if !idx <> 0 && !len >= to_fill + then ( blit buf !off ctx.b !idx to_fill ; sha256_do_chunk ~be32_to_cpu:By.be32_to_cpu ctx ctx.b 0 ; len := !len - to_fill ; off := !off + to_fill ; - idx := 0 ) ; + idx := 0) ; while !len >= 64 do sha256_do_chunk ~be32_to_cpu ctx buf !off ; len := !len - 64 ; diff --git a/src-ocaml/baijiu_sha384.ml b/src-ocaml/baijiu_sha384.ml index bd9bba9..e8151f0 100644 --- a/src-ocaml/baijiu_sha384.ml +++ b/src-ocaml/baijiu_sha384.ml @@ -3,17 +3,22 @@ module Bi = Digestif_bi module type S = sig type ctx - type kind = [`SHA384] + + type kind = [ `SHA384 ] val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`SHA384] + type kind = [ `SHA384 ] open Baijiu_sha512.Unsafe @@ -21,18 +26,29 @@ module Unsafe : S = struct let init () = let b = By.make 128 '\x00' in - { size= [|0L; 0L|] - ; b - ; h= - [| 0xcbbb9d5dc1059ed8L; 0x629a292a367cd507L; 0x9159015a3070dd17L - ; 0x152fecd8f70e5939L; 0x67332667ffc00b31L; 0x8eb44a8768581511L - ; 0xdb0c2e0d64f98fa7L; 0x47b5481dbefa4fa4L |] } + { + size = [| 0L; 0L |]; + b; + h = + [| + 0xcbbb9d5dc1059ed8L; + 0x629a292a367cd507L; + 0x9159015a3070dd17L; + 0x152fecd8f70e5939L; + 0x67332667ffc00b31L; + 0x8eb44a8768581511L; + 0xdb0c2e0d64f98fa7L; + 0x47b5481dbefa4fa4L; + |]; + } let unsafe_get ctx = let res = unsafe_get ctx in By.sub res 0 48 let dup = dup + let unsafe_feed_bytes = unsafe_feed_bytes + let unsafe_feed_bigstring = unsafe_feed_bigstring end diff --git a/src-ocaml/baijiu_sha512.ml b/src-ocaml/baijiu_sha512.ml index 8ad8a15..2ab0b89 100644 --- a/src-ocaml/baijiu_sha512.ml +++ b/src-ocaml/baijiu_sha512.ml @@ -5,108 +5,186 @@ module Int64 = struct include Int64 let ( lsl ) = Int64.shift_left + let ( lsr ) = Int64.shift_right + let ( asr ) = Int64.shift_right_logical + let ( lor ) = Int64.logor + let ( land ) = Int64.logand + let ( lxor ) = Int64.logxor + let ( + ) = Int64.add + let ror64 a n = (a asr n) lor (a lsl (64 - n)) + let rol64 a n = (a lsl n) lor (a asr (64 - n)) end module type S = sig - type kind = [`SHA512] - type ctx = {mutable size: int64 array; b: Bytes.t; h: int64 array} + type kind = [ `SHA512 ] + + type ctx = { mutable size : int64 array; b : Bytes.t; h : int64 array } val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`SHA512] - type ctx = {mutable size: int64 array; b: Bytes.t; h: int64 array} + type kind = [ `SHA512 ] + + type ctx = { mutable size : int64 array; b : Bytes.t; h : int64 array } let dup ctx = - {size= Array.copy ctx.size; b= By.copy ctx.b; h= Array.copy ctx.h} + { size = Array.copy ctx.size; b = By.copy ctx.b; h = Array.copy ctx.h } let init () = let b = By.make 128 '\x00' in - { size= [|0L; 0L|] - ; b - ; h= - [| 0x6a09e667f3bcc908L; 0xbb67ae8584caa73bL; 0x3c6ef372fe94f82bL - ; 0xa54ff53a5f1d36f1L; 0x510e527fade682d1L; 0x9b05688c2b3e6c1fL - ; 0x1f83d9abfb41bd6bL; 0x5be0cd19137e2179L |] } + { + size = [| 0L; 0L |]; + b; + h = + [| + 0x6a09e667f3bcc908L; + 0xbb67ae8584caa73bL; + 0x3c6ef372fe94f82bL; + 0xa54ff53a5f1d36f1L; + 0x510e527fade682d1L; + 0x9b05688c2b3e6c1fL; + 0x1f83d9abfb41bd6bL; + 0x5be0cd19137e2179L; + |]; + } let k = - [| 0x428a2f98d728ae22L; 0x7137449123ef65cdL; 0xb5c0fbcfec4d3b2fL - ; 0xe9b5dba58189dbbcL; 0x3956c25bf348b538L; 0x59f111f1b605d019L - ; 0x923f82a4af194f9bL; 0xab1c5ed5da6d8118L; 0xd807aa98a3030242L - ; 0x12835b0145706fbeL; 0x243185be4ee4b28cL; 0x550c7dc3d5ffb4e2L - ; 0x72be5d74f27b896fL; 0x80deb1fe3b1696b1L; 0x9bdc06a725c71235L - ; 0xc19bf174cf692694L; 0xe49b69c19ef14ad2L; 0xefbe4786384f25e3L - ; 0x0fc19dc68b8cd5b5L; 0x240ca1cc77ac9c65L; 0x2de92c6f592b0275L - ; 0x4a7484aa6ea6e483L; 0x5cb0a9dcbd41fbd4L; 0x76f988da831153b5L - ; 0x983e5152ee66dfabL; 0xa831c66d2db43210L; 0xb00327c898fb213fL - ; 0xbf597fc7beef0ee4L; 0xc6e00bf33da88fc2L; 0xd5a79147930aa725L - ; 0x06ca6351e003826fL; 0x142929670a0e6e70L; 0x27b70a8546d22ffcL - ; 0x2e1b21385c26c926L; 0x4d2c6dfc5ac42aedL; 0x53380d139d95b3dfL - ; 0x650a73548baf63deL; 0x766a0abb3c77b2a8L; 0x81c2c92e47edaee6L - ; 0x92722c851482353bL; 0xa2bfe8a14cf10364L; 0xa81a664bbc423001L - ; 0xc24b8b70d0f89791L; 0xc76c51a30654be30L; 0xd192e819d6ef5218L - ; 0xd69906245565a910L; 0xf40e35855771202aL; 0x106aa07032bbd1b8L - ; 0x19a4c116b8d2d0c8L; 0x1e376c085141ab53L; 0x2748774cdf8eeb99L - ; 0x34b0bcb5e19b48a8L; 0x391c0cb3c5c95a63L; 0x4ed8aa4ae3418acbL - ; 0x5b9cca4f7763e373L; 0x682e6ff3d6b2b8a3L; 0x748f82ee5defb2fcL - ; 0x78a5636f43172f60L; 0x84c87814a1f0ab72L; 0x8cc702081a6439ecL - ; 0x90befffa23631e28L; 0xa4506cebde82bde9L; 0xbef9a3f7b2c67915L - ; 0xc67178f2e372532bL; 0xca273eceea26619cL; 0xd186b8c721c0c207L - ; 0xeada7dd6cde0eb1eL; 0xf57d4f7fee6ed178L; 0x06f067aa72176fbaL - ; 0x0a637dc5a2c898a6L; 0x113f9804bef90daeL; 0x1b710b35131c471bL - ; 0x28db77f523047d84L; 0x32caab7b40c72493L; 0x3c9ebe0a15c9bebcL - ; 0x431d67c49c100d4cL; 0x4cc5d4becb3e42b6L; 0x597f299cfc657e2aL - ; 0x5fcb6fab3ad6faecL; 0x6c44198c4a475817L |] + [| + 0x428a2f98d728ae22L; + 0x7137449123ef65cdL; + 0xb5c0fbcfec4d3b2fL; + 0xe9b5dba58189dbbcL; + 0x3956c25bf348b538L; + 0x59f111f1b605d019L; + 0x923f82a4af194f9bL; + 0xab1c5ed5da6d8118L; + 0xd807aa98a3030242L; + 0x12835b0145706fbeL; + 0x243185be4ee4b28cL; + 0x550c7dc3d5ffb4e2L; + 0x72be5d74f27b896fL; + 0x80deb1fe3b1696b1L; + 0x9bdc06a725c71235L; + 0xc19bf174cf692694L; + 0xe49b69c19ef14ad2L; + 0xefbe4786384f25e3L; + 0x0fc19dc68b8cd5b5L; + 0x240ca1cc77ac9c65L; + 0x2de92c6f592b0275L; + 0x4a7484aa6ea6e483L; + 0x5cb0a9dcbd41fbd4L; + 0x76f988da831153b5L; + 0x983e5152ee66dfabL; + 0xa831c66d2db43210L; + 0xb00327c898fb213fL; + 0xbf597fc7beef0ee4L; + 0xc6e00bf33da88fc2L; + 0xd5a79147930aa725L; + 0x06ca6351e003826fL; + 0x142929670a0e6e70L; + 0x27b70a8546d22ffcL; + 0x2e1b21385c26c926L; + 0x4d2c6dfc5ac42aedL; + 0x53380d139d95b3dfL; + 0x650a73548baf63deL; + 0x766a0abb3c77b2a8L; + 0x81c2c92e47edaee6L; + 0x92722c851482353bL; + 0xa2bfe8a14cf10364L; + 0xa81a664bbc423001L; + 0xc24b8b70d0f89791L; + 0xc76c51a30654be30L; + 0xd192e819d6ef5218L; + 0xd69906245565a910L; + 0xf40e35855771202aL; + 0x106aa07032bbd1b8L; + 0x19a4c116b8d2d0c8L; + 0x1e376c085141ab53L; + 0x2748774cdf8eeb99L; + 0x34b0bcb5e19b48a8L; + 0x391c0cb3c5c95a63L; + 0x4ed8aa4ae3418acbL; + 0x5b9cca4f7763e373L; + 0x682e6ff3d6b2b8a3L; + 0x748f82ee5defb2fcL; + 0x78a5636f43172f60L; + 0x84c87814a1f0ab72L; + 0x8cc702081a6439ecL; + 0x90befffa23631e28L; + 0xa4506cebde82bde9L; + 0xbef9a3f7b2c67915L; + 0xc67178f2e372532bL; + 0xca273eceea26619cL; + 0xd186b8c721c0c207L; + 0xeada7dd6cde0eb1eL; + 0xf57d4f7fee6ed178L; + 0x06f067aa72176fbaL; + 0x0a637dc5a2c898a6L; + 0x113f9804bef90daeL; + 0x1b710b35131c471bL; + 0x28db77f523047d84L; + 0x32caab7b40c72493L; + 0x3c9ebe0a15c9bebcL; + 0x431d67c49c100d4cL; + 0x4cc5d4becb3e42b6L; + 0x597f299cfc657e2aL; + 0x5fcb6fab3ad6faecL; + 0x6c44198c4a475817L; + |] let e0 x = Int64.(ror64 x 28 lxor ror64 x 34 lxor ror64 x 39) + let e1 x = Int64.(ror64 x 14 lxor ror64 x 18 lxor ror64 x 41) + let s0 x = Int64.(ror64 x 1 lxor ror64 x 8 lxor (x asr 7)) + let s1 x = Int64.(ror64 x 19 lxor ror64 x 61 lxor (x asr 6)) - let sha512_do_chunk : type a. - be64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = + let sha512_do_chunk : + type a. be64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = fun ~be64_to_cpu ctx buf off -> let a, b, c, d, e, f, g, h, t1, t2 = - ( ref ctx.h.(0) - , ref ctx.h.(1) - , ref ctx.h.(2) - , ref ctx.h.(3) - , ref ctx.h.(4) - , ref ctx.h.(5) - , ref ctx.h.(6) - , ref ctx.h.(7) - , ref 0L - , ref 0L ) - in + ( ref ctx.h.(0), + ref ctx.h.(1), + ref ctx.h.(2), + ref ctx.h.(3), + ref ctx.h.(4), + ref ctx.h.(5), + ref ctx.h.(6), + ref ctx.h.(7), + ref 0L, + ref 0L ) in let w = Array.make 80 0L in for i = 0 to 15 do w.(i) <- be64_to_cpu buf (off + (i * 8)) done ; let ( -- ) a b = a - b in for i = 16 to 79 do - w.(i) - <- Int64.(s1 w.(i -- 2) + w.(i -- 7) + s0 w.(i -- 15) + w.(i -- 16)) + w.(i) <- Int64.(s1 w.(i -- 2) + w.(i -- 7) + s0 w.(i -- 15) + w.(i -- 16)) done ; let round a b c d e f g h k w = let open Int64 in t1 := !h + e1 !e + (!g lxor (!e land (!f lxor !g))) + k + w ; t2 := e0 !a + (!a land !b lor (!c land (!a lor !b))) ; d := !d + !t1 ; - h := !t1 + !t2 - in + h := !t1 + !t2 in for i = 0 to 9 do round a b c d e f g h k.((i * 8) + 0) w.((i * 8) + 0) ; round h a b c d e f g k.((i * 8) + 1) w.((i * 8) + 1) ; @@ -128,28 +206,30 @@ module Unsafe : S = struct ctx.h.(7) <- ctx.h.(7) + !h ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> be64_to_cpu:(a -> int -> int64) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + be64_to_cpu:(a -> int -> int64) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~be64_to_cpu ctx buf off len -> let idx = ref Int64.(to_int (ctx.size.(0) land 0x7FL)) in let len = ref len in let off = ref off in let to_fill = 128 - !idx in ctx.size.(0) <- Int64.add ctx.size.(0) (Int64.of_int !len) ; - if ctx.size.(0) < Int64.of_int !len then - ctx.size.(1) <- Int64.succ ctx.size.(1) ; - if !idx <> 0 && !len >= to_fill then ( + if ctx.size.(0) < Int64.of_int !len + then ctx.size.(1) <- Int64.succ ctx.size.(1) ; + if !idx <> 0 && !len >= to_fill + then ( blit buf !off ctx.b !idx to_fill ; sha512_do_chunk ~be64_to_cpu:By.be64_to_cpu ctx ctx.b 0 ; len := !len - to_fill ; off := !off + to_fill ; - idx := 0 ) ; + idx := 0) ; while !len >= 128 do sha512_do_chunk ~be64_to_cpu ctx buf !off ; len := !len - 128 ; @@ -168,8 +248,7 @@ module Unsafe : S = struct let padlen = if index < 112 then 112 - index else 128 + 112 - index in let padding = By.init padlen (function 0 -> '\x80' | _ -> '\x00') in let bits = By.create 16 in - By.cpu_to_be64 bits 0 - Int64.((ctx.size.(1) lsl 3) lor (ctx.size.(0) lsr 61)) ; + By.cpu_to_be64 bits 0 Int64.((ctx.size.(1) lsl 3) lor (ctx.size.(0) lsr 61)) ; By.cpu_to_be64 bits 8 Int64.(ctx.size.(0) lsl 3) ; unsafe_feed_bytes ctx padding 0 padlen ; unsafe_feed_bytes ctx bits 0 16 ; diff --git a/src-ocaml/baijiu_whirlpool.ml b/src-ocaml/baijiu_whirlpool.ml index c870a0b..ff3d567 100644 --- a/src-ocaml/baijiu_whirlpool.ml +++ b/src-ocaml/baijiu_whirlpool.ml @@ -5,739 +5,2138 @@ module Int64 = struct include Int64 let ( lsl ) = Int64.shift_left + let ( lsr ) = Int64.shift_right + let ( asr ) = Int64.shift_right_logical + let ( lor ) = Int64.logor + let ( land ) = Int64.logand + let ( lxor ) = Int64.logxor + let ( + ) = Int64.add + let ror64 a n = (a asr n) lor (a lsl (64 - n)) + let rol64 a n = (a lsl n) lor (a asr (64 - n)) end module type S = sig - type kind = [`WHIRLPOOL] - type ctx = {mutable size: int64; b: Bytes.t; h: int64 array} + type kind = [ `WHIRLPOOL ] + + type ctx = { mutable size : int64; b : Bytes.t; h : int64 array } val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end module Unsafe : S = struct - type kind = [`WHIRLPOOL] - type ctx = {mutable size: int64; b: Bytes.t; h: int64 array} + type kind = [ `WHIRLPOOL ] + + type ctx = { mutable size : int64; b : Bytes.t; h : int64 array } - let dup ctx = {size= ctx.size; b= By.copy ctx.b; h= Array.copy ctx.h} + let dup ctx = { size = ctx.size; b = By.copy ctx.b; h = Array.copy ctx.h } let init () = let b = By.make 64 '\x00' in - {size= 0L; b; h= Array.make 8 Int64.zero} + { size = 0L; b; h = Array.make 8 Int64.zero } let k = - [| [| 0x18186018c07830d8L; 0x23238c2305af4626L; 0xc6c63fc67ef991b8L - ; 0xe8e887e8136fcdfbL; 0x878726874ca113cbL; 0xb8b8dab8a9626d11L - ; 0x0101040108050209L; 0x4f4f214f426e9e0dL; 0x3636d836adee6c9bL - ; 0xa6a6a2a6590451ffL; 0xd2d26fd2debdb90cL; 0xf5f5f3f5fb06f70eL - ; 0x7979f979ef80f296L; 0x6f6fa16f5fcede30L; 0x91917e91fcef3f6dL - ; 0x52525552aa07a4f8L; 0x60609d6027fdc047L; 0xbcbccabc89766535L - ; 0x9b9b569baccd2b37L; 0x8e8e028e048c018aL; 0xa3a3b6a371155bd2L - ; 0x0c0c300c603c186cL; 0x7b7bf17bff8af684L; 0x3535d435b5e16a80L - ; 0x1d1d741de8693af5L; 0xe0e0a7e05347ddb3L; 0xd7d77bd7f6acb321L - ; 0xc2c22fc25eed999cL; 0x2e2eb82e6d965c43L; 0x4b4b314b627a9629L - ; 0xfefedffea321e15dL; 0x575741578216aed5L; 0x15155415a8412abdL - ; 0x7777c1779fb6eee8L; 0x3737dc37a5eb6e92L; 0xe5e5b3e57b56d79eL - ; 0x9f9f469f8cd92313L; 0xf0f0e7f0d317fd23L; 0x4a4a354a6a7f9420L - ; 0xdada4fda9e95a944L; 0x58587d58fa25b0a2L; 0xc9c903c906ca8fcfL - ; 0x2929a429558d527cL; 0x0a0a280a5022145aL; 0xb1b1feb1e14f7f50L - ; 0xa0a0baa0691a5dc9L; 0x6b6bb16b7fdad614L; 0x85852e855cab17d9L - ; 0xbdbdcebd8173673cL; 0x5d5d695dd234ba8fL; 0x1010401080502090L - ; 0xf4f4f7f4f303f507L; 0xcbcb0bcb16c08bddL; 0x3e3ef83eedc67cd3L - ; 0x0505140528110a2dL; 0x676781671fe6ce78L; 0xe4e4b7e47353d597L - ; 0x27279c2725bb4e02L; 0x4141194132588273L; 0x8b8b168b2c9d0ba7L - ; 0xa7a7a6a7510153f6L; 0x7d7de97dcf94fab2L; 0x95956e95dcfb3749L - ; 0xd8d847d88e9fad56L; 0xfbfbcbfb8b30eb70L; 0xeeee9fee2371c1cdL - ; 0x7c7ced7cc791f8bbL; 0x6666856617e3cc71L; 0xdddd53dda68ea77bL - ; 0x17175c17b84b2eafL; 0x4747014702468e45L; 0x9e9e429e84dc211aL - ; 0xcaca0fca1ec589d4L; 0x2d2db42d75995a58L; 0xbfbfc6bf9179632eL - ; 0x07071c07381b0e3fL; 0xadad8ead012347acL; 0x5a5a755aea2fb4b0L - ; 0x838336836cb51befL; 0x3333cc3385ff66b6L; 0x636391633ff2c65cL - ; 0x02020802100a0412L; 0xaaaa92aa39384993L; 0x7171d971afa8e2deL - ; 0xc8c807c80ecf8dc6L; 0x19196419c87d32d1L; 0x494939497270923bL - ; 0xd9d943d9869aaf5fL; 0xf2f2eff2c31df931L; 0xe3e3abe34b48dba8L - ; 0x5b5b715be22ab6b9L; 0x88881a8834920dbcL; 0x9a9a529aa4c8293eL - ; 0x262698262dbe4c0bL; 0x3232c8328dfa64bfL; 0xb0b0fab0e94a7d59L - ; 0xe9e983e91b6acff2L; 0x0f0f3c0f78331e77L; 0xd5d573d5e6a6b733L - ; 0x80803a8074ba1df4L; 0xbebec2be997c6127L; 0xcdcd13cd26de87ebL - ; 0x3434d034bde46889L; 0x48483d487a759032L; 0xffffdbffab24e354L - ; 0x7a7af57af78ff48dL; 0x90907a90f4ea3d64L; 0x5f5f615fc23ebe9dL - ; 0x202080201da0403dL; 0x6868bd6867d5d00fL; 0x1a1a681ad07234caL - ; 0xaeae82ae192c41b7L; 0xb4b4eab4c95e757dL; 0x54544d549a19a8ceL - ; 0x93937693ece53b7fL; 0x222288220daa442fL; 0x64648d6407e9c863L - ; 0xf1f1e3f1db12ff2aL; 0x7373d173bfa2e6ccL; 0x12124812905a2482L - ; 0x40401d403a5d807aL; 0x0808200840281048L; 0xc3c32bc356e89b95L - ; 0xecec97ec337bc5dfL; 0xdbdb4bdb9690ab4dL; 0xa1a1bea1611f5fc0L - ; 0x8d8d0e8d1c830791L; 0x3d3df43df5c97ac8L; 0x97976697ccf1335bL - ; 0x0000000000000000L; 0xcfcf1bcf36d483f9L; 0x2b2bac2b4587566eL - ; 0x7676c57697b3ece1L; 0x8282328264b019e6L; 0xd6d67fd6fea9b128L - ; 0x1b1b6c1bd87736c3L; 0xb5b5eeb5c15b7774L; 0xafaf86af112943beL - ; 0x6a6ab56a77dfd41dL; 0x50505d50ba0da0eaL; 0x45450945124c8a57L - ; 0xf3f3ebf3cb18fb38L; 0x3030c0309df060adL; 0xefef9bef2b74c3c4L - ; 0x3f3ffc3fe5c37edaL; 0x55554955921caac7L; 0xa2a2b2a2791059dbL - ; 0xeaea8fea0365c9e9L; 0x656589650fecca6aL; 0xbabad2bab9686903L - ; 0x2f2fbc2f65935e4aL; 0xc0c027c04ee79d8eL; 0xdede5fdebe81a160L - ; 0x1c1c701ce06c38fcL; 0xfdfdd3fdbb2ee746L; 0x4d4d294d52649a1fL - ; 0x92927292e4e03976L; 0x7575c9758fbceafaL; 0x06061806301e0c36L - ; 0x8a8a128a249809aeL; 0xb2b2f2b2f940794bL; 0xe6e6bfe66359d185L - ; 0x0e0e380e70361c7eL; 0x1f1f7c1ff8633ee7L; 0x6262956237f7c455L - ; 0xd4d477d4eea3b53aL; 0xa8a89aa829324d81L; 0x96966296c4f43152L - ; 0xf9f9c3f99b3aef62L; 0xc5c533c566f697a3L; 0x2525942535b14a10L - ; 0x59597959f220b2abL; 0x84842a8454ae15d0L; 0x7272d572b7a7e4c5L - ; 0x3939e439d5dd72ecL; 0x4c4c2d4c5a619816L; 0x5e5e655eca3bbc94L - ; 0x7878fd78e785f09fL; 0x3838e038ddd870e5L; 0x8c8c0a8c14860598L - ; 0xd1d163d1c6b2bf17L; 0xa5a5aea5410b57e4L; 0xe2e2afe2434dd9a1L - ; 0x616199612ff8c24eL; 0xb3b3f6b3f1457b42L; 0x2121842115a54234L - ; 0x9c9c4a9c94d62508L; 0x1e1e781ef0663ceeL; 0x4343114322528661L - ; 0xc7c73bc776fc93b1L; 0xfcfcd7fcb32be54fL; 0x0404100420140824L - ; 0x51515951b208a2e3L; 0x99995e99bcc72f25L; 0x6d6da96d4fc4da22L - ; 0x0d0d340d68391a65L; 0xfafacffa8335e979L; 0xdfdf5bdfb684a369L - ; 0x7e7ee57ed79bfca9L; 0x242490243db44819L; 0x3b3bec3bc5d776feL - ; 0xabab96ab313d4b9aL; 0xcece1fce3ed181f0L; 0x1111441188552299L - ; 0x8f8f068f0c890383L; 0x4e4e254e4a6b9c04L; 0xb7b7e6b7d1517366L - ; 0xebeb8beb0b60cbe0L; 0x3c3cf03cfdcc78c1L; 0x81813e817cbf1ffdL - ; 0x94946a94d4fe3540L; 0xf7f7fbf7eb0cf31cL; 0xb9b9deb9a1676f18L - ; 0x13134c13985f268bL; 0x2c2cb02c7d9c5851L; 0xd3d36bd3d6b8bb05L - ; 0xe7e7bbe76b5cd38cL; 0x6e6ea56e57cbdc39L; 0xc4c437c46ef395aaL - ; 0x03030c03180f061bL; 0x565645568a13acdcL; 0x44440d441a49885eL - ; 0x7f7fe17fdf9efea0L; 0xa9a99ea921374f88L; 0x2a2aa82a4d825467L - ; 0xbbbbd6bbb16d6b0aL; 0xc1c123c146e29f87L; 0x53535153a202a6f1L - ; 0xdcdc57dcae8ba572L; 0x0b0b2c0b58271653L; 0x9d9d4e9d9cd32701L - ; 0x6c6cad6c47c1d82bL; 0x3131c43195f562a4L; 0x7474cd7487b9e8f3L - ; 0xf6f6fff6e309f115L; 0x464605460a438c4cL; 0xacac8aac092645a5L - ; 0x89891e893c970fb5L; 0x14145014a04428b4L; 0xe1e1a3e15b42dfbaL - ; 0x16165816b04e2ca6L; 0x3a3ae83acdd274f7L; 0x6969b9696fd0d206L - ; 0x09092409482d1241L; 0x7070dd70a7ade0d7L; 0xb6b6e2b6d954716fL - ; 0xd0d067d0ceb7bd1eL; 0xeded93ed3b7ec7d6L; 0xcccc17cc2edb85e2L - ; 0x424215422a578468L; 0x98985a98b4c22d2cL; 0xa4a4aaa4490e55edL - ; 0x2828a0285d885075L; 0x5c5c6d5cda31b886L; 0xf8f8c7f8933fed6bL - ; 0x8686228644a411c2L |] - ; [| 0xd818186018c07830L; 0x2623238c2305af46L; 0xb8c6c63fc67ef991L - ; 0xfbe8e887e8136fcdL; 0xcb878726874ca113L; 0x11b8b8dab8a9626dL - ; 0x0901010401080502L; 0x0d4f4f214f426e9eL; 0x9b3636d836adee6cL - ; 0xffa6a6a2a6590451L; 0x0cd2d26fd2debdb9L; 0x0ef5f5f3f5fb06f7L - ; 0x967979f979ef80f2L; 0x306f6fa16f5fcedeL; 0x6d91917e91fcef3fL - ; 0xf852525552aa07a4L; 0x4760609d6027fdc0L; 0x35bcbccabc897665L - ; 0x379b9b569baccd2bL; 0x8a8e8e028e048c01L; 0xd2a3a3b6a371155bL - ; 0x6c0c0c300c603c18L; 0x847b7bf17bff8af6L; 0x803535d435b5e16aL - ; 0xf51d1d741de8693aL; 0xb3e0e0a7e05347ddL; 0x21d7d77bd7f6acb3L - ; 0x9cc2c22fc25eed99L; 0x432e2eb82e6d965cL; 0x294b4b314b627a96L - ; 0x5dfefedffea321e1L; 0xd5575741578216aeL; 0xbd15155415a8412aL - ; 0xe87777c1779fb6eeL; 0x923737dc37a5eb6eL; 0x9ee5e5b3e57b56d7L - ; 0x139f9f469f8cd923L; 0x23f0f0e7f0d317fdL; 0x204a4a354a6a7f94L - ; 0x44dada4fda9e95a9L; 0xa258587d58fa25b0L; 0xcfc9c903c906ca8fL - ; 0x7c2929a429558d52L; 0x5a0a0a280a502214L; 0x50b1b1feb1e14f7fL - ; 0xc9a0a0baa0691a5dL; 0x146b6bb16b7fdad6L; 0xd985852e855cab17L - ; 0x3cbdbdcebd817367L; 0x8f5d5d695dd234baL; 0x9010104010805020L - ; 0x07f4f4f7f4f303f5L; 0xddcbcb0bcb16c08bL; 0xd33e3ef83eedc67cL - ; 0x2d0505140528110aL; 0x78676781671fe6ceL; 0x97e4e4b7e47353d5L - ; 0x0227279c2725bb4eL; 0x7341411941325882L; 0xa78b8b168b2c9d0bL - ; 0xf6a7a7a6a7510153L; 0xb27d7de97dcf94faL; 0x4995956e95dcfb37L - ; 0x56d8d847d88e9fadL; 0x70fbfbcbfb8b30ebL; 0xcdeeee9fee2371c1L - ; 0xbb7c7ced7cc791f8L; 0x716666856617e3ccL; 0x7bdddd53dda68ea7L - ; 0xaf17175c17b84b2eL; 0x454747014702468eL; 0x1a9e9e429e84dc21L - ; 0xd4caca0fca1ec589L; 0x582d2db42d75995aL; 0x2ebfbfc6bf917963L - ; 0x3f07071c07381b0eL; 0xacadad8ead012347L; 0xb05a5a755aea2fb4L - ; 0xef838336836cb51bL; 0xb63333cc3385ff66L; 0x5c636391633ff2c6L - ; 0x1202020802100a04L; 0x93aaaa92aa393849L; 0xde7171d971afa8e2L - ; 0xc6c8c807c80ecf8dL; 0xd119196419c87d32L; 0x3b49493949727092L - ; 0x5fd9d943d9869aafL; 0x31f2f2eff2c31df9L; 0xa8e3e3abe34b48dbL - ; 0xb95b5b715be22ab6L; 0xbc88881a8834920dL; 0x3e9a9a529aa4c829L - ; 0x0b262698262dbe4cL; 0xbf3232c8328dfa64L; 0x59b0b0fab0e94a7dL - ; 0xf2e9e983e91b6acfL; 0x770f0f3c0f78331eL; 0x33d5d573d5e6a6b7L - ; 0xf480803a8074ba1dL; 0x27bebec2be997c61L; 0xebcdcd13cd26de87L - ; 0x893434d034bde468L; 0x3248483d487a7590L; 0x54ffffdbffab24e3L - ; 0x8d7a7af57af78ff4L; 0x6490907a90f4ea3dL; 0x9d5f5f615fc23ebeL - ; 0x3d202080201da040L; 0x0f6868bd6867d5d0L; 0xca1a1a681ad07234L - ; 0xb7aeae82ae192c41L; 0x7db4b4eab4c95e75L; 0xce54544d549a19a8L - ; 0x7f93937693ece53bL; 0x2f222288220daa44L; 0x6364648d6407e9c8L - ; 0x2af1f1e3f1db12ffL; 0xcc7373d173bfa2e6L; 0x8212124812905a24L - ; 0x7a40401d403a5d80L; 0x4808082008402810L; 0x95c3c32bc356e89bL - ; 0xdfecec97ec337bc5L; 0x4ddbdb4bdb9690abL; 0xc0a1a1bea1611f5fL - ; 0x918d8d0e8d1c8307L; 0xc83d3df43df5c97aL; 0x5b97976697ccf133L - ; 0x0000000000000000L; 0xf9cfcf1bcf36d483L; 0x6e2b2bac2b458756L - ; 0xe17676c57697b3ecL; 0xe68282328264b019L; 0x28d6d67fd6fea9b1L - ; 0xc31b1b6c1bd87736L; 0x74b5b5eeb5c15b77L; 0xbeafaf86af112943L - ; 0x1d6a6ab56a77dfd4L; 0xea50505d50ba0da0L; 0x5745450945124c8aL - ; 0x38f3f3ebf3cb18fbL; 0xad3030c0309df060L; 0xc4efef9bef2b74c3L - ; 0xda3f3ffc3fe5c37eL; 0xc755554955921caaL; 0xdba2a2b2a2791059L - ; 0xe9eaea8fea0365c9L; 0x6a656589650feccaL; 0x03babad2bab96869L - ; 0x4a2f2fbc2f65935eL; 0x8ec0c027c04ee79dL; 0x60dede5fdebe81a1L - ; 0xfc1c1c701ce06c38L; 0x46fdfdd3fdbb2ee7L; 0x1f4d4d294d52649aL - ; 0x7692927292e4e039L; 0xfa7575c9758fbceaL; 0x3606061806301e0cL - ; 0xae8a8a128a249809L; 0x4bb2b2f2b2f94079L; 0x85e6e6bfe66359d1L - ; 0x7e0e0e380e70361cL; 0xe71f1f7c1ff8633eL; 0x556262956237f7c4L - ; 0x3ad4d477d4eea3b5L; 0x81a8a89aa829324dL; 0x5296966296c4f431L - ; 0x62f9f9c3f99b3aefL; 0xa3c5c533c566f697L; 0x102525942535b14aL - ; 0xab59597959f220b2L; 0xd084842a8454ae15L; 0xc57272d572b7a7e4L - ; 0xec3939e439d5dd72L; 0x164c4c2d4c5a6198L; 0x945e5e655eca3bbcL - ; 0x9f7878fd78e785f0L; 0xe53838e038ddd870L; 0x988c8c0a8c148605L - ; 0x17d1d163d1c6b2bfL; 0xe4a5a5aea5410b57L; 0xa1e2e2afe2434dd9L - ; 0x4e616199612ff8c2L; 0x42b3b3f6b3f1457bL; 0x342121842115a542L - ; 0x089c9c4a9c94d625L; 0xee1e1e781ef0663cL; 0x6143431143225286L - ; 0xb1c7c73bc776fc93L; 0x4ffcfcd7fcb32be5L; 0x2404041004201408L - ; 0xe351515951b208a2L; 0x2599995e99bcc72fL; 0x226d6da96d4fc4daL - ; 0x650d0d340d68391aL; 0x79fafacffa8335e9L; 0x69dfdf5bdfb684a3L - ; 0xa97e7ee57ed79bfcL; 0x19242490243db448L; 0xfe3b3bec3bc5d776L - ; 0x9aabab96ab313d4bL; 0xf0cece1fce3ed181L; 0x9911114411885522L - ; 0x838f8f068f0c8903L; 0x044e4e254e4a6b9cL; 0x66b7b7e6b7d15173L - ; 0xe0ebeb8beb0b60cbL; 0xc13c3cf03cfdcc78L; 0xfd81813e817cbf1fL - ; 0x4094946a94d4fe35L; 0x1cf7f7fbf7eb0cf3L; 0x18b9b9deb9a1676fL - ; 0x8b13134c13985f26L; 0x512c2cb02c7d9c58L; 0x05d3d36bd3d6b8bbL - ; 0x8ce7e7bbe76b5cd3L; 0x396e6ea56e57cbdcL; 0xaac4c437c46ef395L - ; 0x1b03030c03180f06L; 0xdc565645568a13acL; 0x5e44440d441a4988L - ; 0xa07f7fe17fdf9efeL; 0x88a9a99ea921374fL; 0x672a2aa82a4d8254L - ; 0x0abbbbd6bbb16d6bL; 0x87c1c123c146e29fL; 0xf153535153a202a6L - ; 0x72dcdc57dcae8ba5L; 0x530b0b2c0b582716L; 0x019d9d4e9d9cd327L - ; 0x2b6c6cad6c47c1d8L; 0xa43131c43195f562L; 0xf37474cd7487b9e8L - ; 0x15f6f6fff6e309f1L; 0x4c464605460a438cL; 0xa5acac8aac092645L - ; 0xb589891e893c970fL; 0xb414145014a04428L; 0xbae1e1a3e15b42dfL - ; 0xa616165816b04e2cL; 0xf73a3ae83acdd274L; 0x066969b9696fd0d2L - ; 0x4109092409482d12L; 0xd77070dd70a7ade0L; 0x6fb6b6e2b6d95471L - ; 0x1ed0d067d0ceb7bdL; 0xd6eded93ed3b7ec7L; 0xe2cccc17cc2edb85L - ; 0x68424215422a5784L; 0x2c98985a98b4c22dL; 0xeda4a4aaa4490e55L - ; 0x752828a0285d8850L; 0x865c5c6d5cda31b8L; 0x6bf8f8c7f8933fedL - ; 0xc28686228644a411L |] - ; [| 0x30d818186018c078L; 0x462623238c2305afL; 0x91b8c6c63fc67ef9L - ; 0xcdfbe8e887e8136fL; 0x13cb878726874ca1L; 0x6d11b8b8dab8a962L - ; 0x0209010104010805L; 0x9e0d4f4f214f426eL; 0x6c9b3636d836adeeL - ; 0x51ffa6a6a2a65904L; 0xb90cd2d26fd2debdL; 0xf70ef5f5f3f5fb06L - ; 0xf2967979f979ef80L; 0xde306f6fa16f5fceL; 0x3f6d91917e91fcefL - ; 0xa4f852525552aa07L; 0xc04760609d6027fdL; 0x6535bcbccabc8976L - ; 0x2b379b9b569baccdL; 0x018a8e8e028e048cL; 0x5bd2a3a3b6a37115L - ; 0x186c0c0c300c603cL; 0xf6847b7bf17bff8aL; 0x6a803535d435b5e1L - ; 0x3af51d1d741de869L; 0xddb3e0e0a7e05347L; 0xb321d7d77bd7f6acL - ; 0x999cc2c22fc25eedL; 0x5c432e2eb82e6d96L; 0x96294b4b314b627aL - ; 0xe15dfefedffea321L; 0xaed5575741578216L; 0x2abd15155415a841L - ; 0xeee87777c1779fb6L; 0x6e923737dc37a5ebL; 0xd79ee5e5b3e57b56L - ; 0x23139f9f469f8cd9L; 0xfd23f0f0e7f0d317L; 0x94204a4a354a6a7fL - ; 0xa944dada4fda9e95L; 0xb0a258587d58fa25L; 0x8fcfc9c903c906caL - ; 0x527c2929a429558dL; 0x145a0a0a280a5022L; 0x7f50b1b1feb1e14fL - ; 0x5dc9a0a0baa0691aL; 0xd6146b6bb16b7fdaL; 0x17d985852e855cabL - ; 0x673cbdbdcebd8173L; 0xba8f5d5d695dd234L; 0x2090101040108050L - ; 0xf507f4f4f7f4f303L; 0x8bddcbcb0bcb16c0L; 0x7cd33e3ef83eedc6L - ; 0x0a2d050514052811L; 0xce78676781671fe6L; 0xd597e4e4b7e47353L - ; 0x4e0227279c2725bbL; 0x8273414119413258L; 0x0ba78b8b168b2c9dL - ; 0x53f6a7a7a6a75101L; 0xfab27d7de97dcf94L; 0x374995956e95dcfbL - ; 0xad56d8d847d88e9fL; 0xeb70fbfbcbfb8b30L; 0xc1cdeeee9fee2371L - ; 0xf8bb7c7ced7cc791L; 0xcc716666856617e3L; 0xa77bdddd53dda68eL - ; 0x2eaf17175c17b84bL; 0x8e45474701470246L; 0x211a9e9e429e84dcL - ; 0x89d4caca0fca1ec5L; 0x5a582d2db42d7599L; 0x632ebfbfc6bf9179L - ; 0x0e3f07071c07381bL; 0x47acadad8ead0123L; 0xb4b05a5a755aea2fL - ; 0x1bef838336836cb5L; 0x66b63333cc3385ffL; 0xc65c636391633ff2L - ; 0x041202020802100aL; 0x4993aaaa92aa3938L; 0xe2de7171d971afa8L - ; 0x8dc6c8c807c80ecfL; 0x32d119196419c87dL; 0x923b494939497270L - ; 0xaf5fd9d943d9869aL; 0xf931f2f2eff2c31dL; 0xdba8e3e3abe34b48L - ; 0xb6b95b5b715be22aL; 0x0dbc88881a883492L; 0x293e9a9a529aa4c8L - ; 0x4c0b262698262dbeL; 0x64bf3232c8328dfaL; 0x7d59b0b0fab0e94aL - ; 0xcff2e9e983e91b6aL; 0x1e770f0f3c0f7833L; 0xb733d5d573d5e6a6L - ; 0x1df480803a8074baL; 0x6127bebec2be997cL; 0x87ebcdcd13cd26deL - ; 0x68893434d034bde4L; 0x903248483d487a75L; 0xe354ffffdbffab24L - ; 0xf48d7a7af57af78fL; 0x3d6490907a90f4eaL; 0xbe9d5f5f615fc23eL - ; 0x403d202080201da0L; 0xd00f6868bd6867d5L; 0x34ca1a1a681ad072L - ; 0x41b7aeae82ae192cL; 0x757db4b4eab4c95eL; 0xa8ce54544d549a19L - ; 0x3b7f93937693ece5L; 0x442f222288220daaL; 0xc86364648d6407e9L - ; 0xff2af1f1e3f1db12L; 0xe6cc7373d173bfa2L; 0x248212124812905aL - ; 0x807a40401d403a5dL; 0x1048080820084028L; 0x9b95c3c32bc356e8L - ; 0xc5dfecec97ec337bL; 0xab4ddbdb4bdb9690L; 0x5fc0a1a1bea1611fL - ; 0x07918d8d0e8d1c83L; 0x7ac83d3df43df5c9L; 0x335b97976697ccf1L - ; 0x0000000000000000L; 0x83f9cfcf1bcf36d4L; 0x566e2b2bac2b4587L - ; 0xece17676c57697b3L; 0x19e68282328264b0L; 0xb128d6d67fd6fea9L - ; 0x36c31b1b6c1bd877L; 0x7774b5b5eeb5c15bL; 0x43beafaf86af1129L - ; 0xd41d6a6ab56a77dfL; 0xa0ea50505d50ba0dL; 0x8a5745450945124cL - ; 0xfb38f3f3ebf3cb18L; 0x60ad3030c0309df0L; 0xc3c4efef9bef2b74L - ; 0x7eda3f3ffc3fe5c3L; 0xaac755554955921cL; 0x59dba2a2b2a27910L - ; 0xc9e9eaea8fea0365L; 0xca6a656589650fecL; 0x6903babad2bab968L - ; 0x5e4a2f2fbc2f6593L; 0x9d8ec0c027c04ee7L; 0xa160dede5fdebe81L - ; 0x38fc1c1c701ce06cL; 0xe746fdfdd3fdbb2eL; 0x9a1f4d4d294d5264L - ; 0x397692927292e4e0L; 0xeafa7575c9758fbcL; 0x0c3606061806301eL - ; 0x09ae8a8a128a2498L; 0x794bb2b2f2b2f940L; 0xd185e6e6bfe66359L - ; 0x1c7e0e0e380e7036L; 0x3ee71f1f7c1ff863L; 0xc4556262956237f7L - ; 0xb53ad4d477d4eea3L; 0x4d81a8a89aa82932L; 0x315296966296c4f4L - ; 0xef62f9f9c3f99b3aL; 0x97a3c5c533c566f6L; 0x4a102525942535b1L - ; 0xb2ab59597959f220L; 0x15d084842a8454aeL; 0xe4c57272d572b7a7L - ; 0x72ec3939e439d5ddL; 0x98164c4c2d4c5a61L; 0xbc945e5e655eca3bL - ; 0xf09f7878fd78e785L; 0x70e53838e038ddd8L; 0x05988c8c0a8c1486L - ; 0xbf17d1d163d1c6b2L; 0x57e4a5a5aea5410bL; 0xd9a1e2e2afe2434dL - ; 0xc24e616199612ff8L; 0x7b42b3b3f6b3f145L; 0x42342121842115a5L - ; 0x25089c9c4a9c94d6L; 0x3cee1e1e781ef066L; 0x8661434311432252L - ; 0x93b1c7c73bc776fcL; 0xe54ffcfcd7fcb32bL; 0x0824040410042014L - ; 0xa2e351515951b208L; 0x2f2599995e99bcc7L; 0xda226d6da96d4fc4L - ; 0x1a650d0d340d6839L; 0xe979fafacffa8335L; 0xa369dfdf5bdfb684L - ; 0xfca97e7ee57ed79bL; 0x4819242490243db4L; 0x76fe3b3bec3bc5d7L - ; 0x4b9aabab96ab313dL; 0x81f0cece1fce3ed1L; 0x2299111144118855L - ; 0x03838f8f068f0c89L; 0x9c044e4e254e4a6bL; 0x7366b7b7e6b7d151L - ; 0xcbe0ebeb8beb0b60L; 0x78c13c3cf03cfdccL; 0x1ffd81813e817cbfL - ; 0x354094946a94d4feL; 0xf31cf7f7fbf7eb0cL; 0x6f18b9b9deb9a167L - ; 0x268b13134c13985fL; 0x58512c2cb02c7d9cL; 0xbb05d3d36bd3d6b8L - ; 0xd38ce7e7bbe76b5cL; 0xdc396e6ea56e57cbL; 0x95aac4c437c46ef3L - ; 0x061b03030c03180fL; 0xacdc565645568a13L; 0x885e44440d441a49L - ; 0xfea07f7fe17fdf9eL; 0x4f88a9a99ea92137L; 0x54672a2aa82a4d82L - ; 0x6b0abbbbd6bbb16dL; 0x9f87c1c123c146e2L; 0xa6f153535153a202L - ; 0xa572dcdc57dcae8bL; 0x16530b0b2c0b5827L; 0x27019d9d4e9d9cd3L - ; 0xd82b6c6cad6c47c1L; 0x62a43131c43195f5L; 0xe8f37474cd7487b9L - ; 0xf115f6f6fff6e309L; 0x8c4c464605460a43L; 0x45a5acac8aac0926L - ; 0x0fb589891e893c97L; 0x28b414145014a044L; 0xdfbae1e1a3e15b42L - ; 0x2ca616165816b04eL; 0x74f73a3ae83acdd2L; 0xd2066969b9696fd0L - ; 0x124109092409482dL; 0xe0d77070dd70a7adL; 0x716fb6b6e2b6d954L - ; 0xbd1ed0d067d0ceb7L; 0xc7d6eded93ed3b7eL; 0x85e2cccc17cc2edbL - ; 0x8468424215422a57L; 0x2d2c98985a98b4c2L; 0x55eda4a4aaa4490eL - ; 0x50752828a0285d88L; 0xb8865c5c6d5cda31L; 0xed6bf8f8c7f8933fL - ; 0x11c28686228644a4L |] - ; [| 0x7830d818186018c0L; 0xaf462623238c2305L; 0xf991b8c6c63fc67eL - ; 0x6fcdfbe8e887e813L; 0xa113cb878726874cL; 0x626d11b8b8dab8a9L - ; 0x0502090101040108L; 0x6e9e0d4f4f214f42L; 0xee6c9b3636d836adL - ; 0x0451ffa6a6a2a659L; 0xbdb90cd2d26fd2deL; 0x06f70ef5f5f3f5fbL - ; 0x80f2967979f979efL; 0xcede306f6fa16f5fL; 0xef3f6d91917e91fcL - ; 0x07a4f852525552aaL; 0xfdc04760609d6027L; 0x766535bcbccabc89L - ; 0xcd2b379b9b569bacL; 0x8c018a8e8e028e04L; 0x155bd2a3a3b6a371L - ; 0x3c186c0c0c300c60L; 0x8af6847b7bf17bffL; 0xe16a803535d435b5L - ; 0x693af51d1d741de8L; 0x47ddb3e0e0a7e053L; 0xacb321d7d77bd7f6L - ; 0xed999cc2c22fc25eL; 0x965c432e2eb82e6dL; 0x7a96294b4b314b62L - ; 0x21e15dfefedffea3L; 0x16aed55757415782L; 0x412abd15155415a8L - ; 0xb6eee87777c1779fL; 0xeb6e923737dc37a5L; 0x56d79ee5e5b3e57bL - ; 0xd923139f9f469f8cL; 0x17fd23f0f0e7f0d3L; 0x7f94204a4a354a6aL - ; 0x95a944dada4fda9eL; 0x25b0a258587d58faL; 0xca8fcfc9c903c906L - ; 0x8d527c2929a42955L; 0x22145a0a0a280a50L; 0x4f7f50b1b1feb1e1L - ; 0x1a5dc9a0a0baa069L; 0xdad6146b6bb16b7fL; 0xab17d985852e855cL - ; 0x73673cbdbdcebd81L; 0x34ba8f5d5d695dd2L; 0x5020901010401080L - ; 0x03f507f4f4f7f4f3L; 0xc08bddcbcb0bcb16L; 0xc67cd33e3ef83eedL - ; 0x110a2d0505140528L; 0xe6ce78676781671fL; 0x53d597e4e4b7e473L - ; 0xbb4e0227279c2725L; 0x5882734141194132L; 0x9d0ba78b8b168b2cL - ; 0x0153f6a7a7a6a751L; 0x94fab27d7de97dcfL; 0xfb374995956e95dcL - ; 0x9fad56d8d847d88eL; 0x30eb70fbfbcbfb8bL; 0x71c1cdeeee9fee23L - ; 0x91f8bb7c7ced7cc7L; 0xe3cc716666856617L; 0x8ea77bdddd53dda6L - ; 0x4b2eaf17175c17b8L; 0x468e454747014702L; 0xdc211a9e9e429e84L - ; 0xc589d4caca0fca1eL; 0x995a582d2db42d75L; 0x79632ebfbfc6bf91L - ; 0x1b0e3f07071c0738L; 0x2347acadad8ead01L; 0x2fb4b05a5a755aeaL - ; 0xb51bef838336836cL; 0xff66b63333cc3385L; 0xf2c65c636391633fL - ; 0x0a04120202080210L; 0x384993aaaa92aa39L; 0xa8e2de7171d971afL - ; 0xcf8dc6c8c807c80eL; 0x7d32d119196419c8L; 0x70923b4949394972L - ; 0x9aaf5fd9d943d986L; 0x1df931f2f2eff2c3L; 0x48dba8e3e3abe34bL - ; 0x2ab6b95b5b715be2L; 0x920dbc88881a8834L; 0xc8293e9a9a529aa4L - ; 0xbe4c0b262698262dL; 0xfa64bf3232c8328dL; 0x4a7d59b0b0fab0e9L - ; 0x6acff2e9e983e91bL; 0x331e770f0f3c0f78L; 0xa6b733d5d573d5e6L - ; 0xba1df480803a8074L; 0x7c6127bebec2be99L; 0xde87ebcdcd13cd26L - ; 0xe468893434d034bdL; 0x75903248483d487aL; 0x24e354ffffdbffabL - ; 0x8ff48d7a7af57af7L; 0xea3d6490907a90f4L; 0x3ebe9d5f5f615fc2L - ; 0xa0403d202080201dL; 0xd5d00f6868bd6867L; 0x7234ca1a1a681ad0L - ; 0x2c41b7aeae82ae19L; 0x5e757db4b4eab4c9L; 0x19a8ce54544d549aL - ; 0xe53b7f93937693ecL; 0xaa442f222288220dL; 0xe9c86364648d6407L - ; 0x12ff2af1f1e3f1dbL; 0xa2e6cc7373d173bfL; 0x5a24821212481290L - ; 0x5d807a40401d403aL; 0x2810480808200840L; 0xe89b95c3c32bc356L - ; 0x7bc5dfecec97ec33L; 0x90ab4ddbdb4bdb96L; 0x1f5fc0a1a1bea161L - ; 0x8307918d8d0e8d1cL; 0xc97ac83d3df43df5L; 0xf1335b97976697ccL - ; 0x0000000000000000L; 0xd483f9cfcf1bcf36L; 0x87566e2b2bac2b45L - ; 0xb3ece17676c57697L; 0xb019e68282328264L; 0xa9b128d6d67fd6feL - ; 0x7736c31b1b6c1bd8L; 0x5b7774b5b5eeb5c1L; 0x2943beafaf86af11L - ; 0xdfd41d6a6ab56a77L; 0x0da0ea50505d50baL; 0x4c8a574545094512L - ; 0x18fb38f3f3ebf3cbL; 0xf060ad3030c0309dL; 0x74c3c4efef9bef2bL - ; 0xc37eda3f3ffc3fe5L; 0x1caac75555495592L; 0x1059dba2a2b2a279L - ; 0x65c9e9eaea8fea03L; 0xecca6a656589650fL; 0x686903babad2bab9L - ; 0x935e4a2f2fbc2f65L; 0xe79d8ec0c027c04eL; 0x81a160dede5fdebeL - ; 0x6c38fc1c1c701ce0L; 0x2ee746fdfdd3fdbbL; 0x649a1f4d4d294d52L - ; 0xe0397692927292e4L; 0xbceafa7575c9758fL; 0x1e0c360606180630L - ; 0x9809ae8a8a128a24L; 0x40794bb2b2f2b2f9L; 0x59d185e6e6bfe663L - ; 0x361c7e0e0e380e70L; 0x633ee71f1f7c1ff8L; 0xf7c4556262956237L - ; 0xa3b53ad4d477d4eeL; 0x324d81a8a89aa829L; 0xf4315296966296c4L - ; 0x3aef62f9f9c3f99bL; 0xf697a3c5c533c566L; 0xb14a102525942535L - ; 0x20b2ab59597959f2L; 0xae15d084842a8454L; 0xa7e4c57272d572b7L - ; 0xdd72ec3939e439d5L; 0x6198164c4c2d4c5aL; 0x3bbc945e5e655ecaL - ; 0x85f09f7878fd78e7L; 0xd870e53838e038ddL; 0x8605988c8c0a8c14L - ; 0xb2bf17d1d163d1c6L; 0x0b57e4a5a5aea541L; 0x4dd9a1e2e2afe243L - ; 0xf8c24e616199612fL; 0x457b42b3b3f6b3f1L; 0xa542342121842115L - ; 0xd625089c9c4a9c94L; 0x663cee1e1e781ef0L; 0x5286614343114322L - ; 0xfc93b1c7c73bc776L; 0x2be54ffcfcd7fcb3L; 0x1408240404100420L - ; 0x08a2e351515951b2L; 0xc72f2599995e99bcL; 0xc4da226d6da96d4fL - ; 0x391a650d0d340d68L; 0x35e979fafacffa83L; 0x84a369dfdf5bdfb6L - ; 0x9bfca97e7ee57ed7L; 0xb44819242490243dL; 0xd776fe3b3bec3bc5L - ; 0x3d4b9aabab96ab31L; 0xd181f0cece1fce3eL; 0x5522991111441188L - ; 0x8903838f8f068f0cL; 0x6b9c044e4e254e4aL; 0x517366b7b7e6b7d1L - ; 0x60cbe0ebeb8beb0bL; 0xcc78c13c3cf03cfdL; 0xbf1ffd81813e817cL - ; 0xfe354094946a94d4L; 0x0cf31cf7f7fbf7ebL; 0x676f18b9b9deb9a1L - ; 0x5f268b13134c1398L; 0x9c58512c2cb02c7dL; 0xb8bb05d3d36bd3d6L - ; 0x5cd38ce7e7bbe76bL; 0xcbdc396e6ea56e57L; 0xf395aac4c437c46eL - ; 0x0f061b03030c0318L; 0x13acdc565645568aL; 0x49885e44440d441aL - ; 0x9efea07f7fe17fdfL; 0x374f88a9a99ea921L; 0x8254672a2aa82a4dL - ; 0x6d6b0abbbbd6bbb1L; 0xe29f87c1c123c146L; 0x02a6f153535153a2L - ; 0x8ba572dcdc57dcaeL; 0x2716530b0b2c0b58L; 0xd327019d9d4e9d9cL - ; 0xc1d82b6c6cad6c47L; 0xf562a43131c43195L; 0xb9e8f37474cd7487L - ; 0x09f115f6f6fff6e3L; 0x438c4c464605460aL; 0x2645a5acac8aac09L - ; 0x970fb589891e893cL; 0x4428b414145014a0L; 0x42dfbae1e1a3e15bL - ; 0x4e2ca616165816b0L; 0xd274f73a3ae83acdL; 0xd0d2066969b9696fL - ; 0x2d12410909240948L; 0xade0d77070dd70a7L; 0x54716fb6b6e2b6d9L - ; 0xb7bd1ed0d067d0ceL; 0x7ec7d6eded93ed3bL; 0xdb85e2cccc17cc2eL - ; 0x578468424215422aL; 0xc22d2c98985a98b4L; 0x0e55eda4a4aaa449L - ; 0x8850752828a0285dL; 0x31b8865c5c6d5cdaL; 0x3fed6bf8f8c7f893L - ; 0xa411c28686228644L |] - ; [| 0xc07830d818186018L; 0x05af462623238c23L; 0x7ef991b8c6c63fc6L - ; 0x136fcdfbe8e887e8L; 0x4ca113cb87872687L; 0xa9626d11b8b8dab8L - ; 0x0805020901010401L; 0x426e9e0d4f4f214fL; 0xadee6c9b3636d836L - ; 0x590451ffa6a6a2a6L; 0xdebdb90cd2d26fd2L; 0xfb06f70ef5f5f3f5L - ; 0xef80f2967979f979L; 0x5fcede306f6fa16fL; 0xfcef3f6d91917e91L - ; 0xaa07a4f852525552L; 0x27fdc04760609d60L; 0x89766535bcbccabcL - ; 0xaccd2b379b9b569bL; 0x048c018a8e8e028eL; 0x71155bd2a3a3b6a3L - ; 0x603c186c0c0c300cL; 0xff8af6847b7bf17bL; 0xb5e16a803535d435L - ; 0xe8693af51d1d741dL; 0x5347ddb3e0e0a7e0L; 0xf6acb321d7d77bd7L - ; 0x5eed999cc2c22fc2L; 0x6d965c432e2eb82eL; 0x627a96294b4b314bL - ; 0xa321e15dfefedffeL; 0x8216aed557574157L; 0xa8412abd15155415L - ; 0x9fb6eee87777c177L; 0xa5eb6e923737dc37L; 0x7b56d79ee5e5b3e5L - ; 0x8cd923139f9f469fL; 0xd317fd23f0f0e7f0L; 0x6a7f94204a4a354aL - ; 0x9e95a944dada4fdaL; 0xfa25b0a258587d58L; 0x06ca8fcfc9c903c9L - ; 0x558d527c2929a429L; 0x5022145a0a0a280aL; 0xe14f7f50b1b1feb1L - ; 0x691a5dc9a0a0baa0L; 0x7fdad6146b6bb16bL; 0x5cab17d985852e85L - ; 0x8173673cbdbdcebdL; 0xd234ba8f5d5d695dL; 0x8050209010104010L - ; 0xf303f507f4f4f7f4L; 0x16c08bddcbcb0bcbL; 0xedc67cd33e3ef83eL - ; 0x28110a2d05051405L; 0x1fe6ce7867678167L; 0x7353d597e4e4b7e4L - ; 0x25bb4e0227279c27L; 0x3258827341411941L; 0x2c9d0ba78b8b168bL - ; 0x510153f6a7a7a6a7L; 0xcf94fab27d7de97dL; 0xdcfb374995956e95L - ; 0x8e9fad56d8d847d8L; 0x8b30eb70fbfbcbfbL; 0x2371c1cdeeee9feeL - ; 0xc791f8bb7c7ced7cL; 0x17e3cc7166668566L; 0xa68ea77bdddd53ddL - ; 0xb84b2eaf17175c17L; 0x02468e4547470147L; 0x84dc211a9e9e429eL - ; 0x1ec589d4caca0fcaL; 0x75995a582d2db42dL; 0x9179632ebfbfc6bfL - ; 0x381b0e3f07071c07L; 0x012347acadad8eadL; 0xea2fb4b05a5a755aL - ; 0x6cb51bef83833683L; 0x85ff66b63333cc33L; 0x3ff2c65c63639163L - ; 0x100a041202020802L; 0x39384993aaaa92aaL; 0xafa8e2de7171d971L - ; 0x0ecf8dc6c8c807c8L; 0xc87d32d119196419L; 0x7270923b49493949L - ; 0x869aaf5fd9d943d9L; 0xc31df931f2f2eff2L; 0x4b48dba8e3e3abe3L - ; 0xe22ab6b95b5b715bL; 0x34920dbc88881a88L; 0xa4c8293e9a9a529aL - ; 0x2dbe4c0b26269826L; 0x8dfa64bf3232c832L; 0xe94a7d59b0b0fab0L - ; 0x1b6acff2e9e983e9L; 0x78331e770f0f3c0fL; 0xe6a6b733d5d573d5L - ; 0x74ba1df480803a80L; 0x997c6127bebec2beL; 0x26de87ebcdcd13cdL - ; 0xbde468893434d034L; 0x7a75903248483d48L; 0xab24e354ffffdbffL - ; 0xf78ff48d7a7af57aL; 0xf4ea3d6490907a90L; 0xc23ebe9d5f5f615fL - ; 0x1da0403d20208020L; 0x67d5d00f6868bd68L; 0xd07234ca1a1a681aL - ; 0x192c41b7aeae82aeL; 0xc95e757db4b4eab4L; 0x9a19a8ce54544d54L - ; 0xece53b7f93937693L; 0x0daa442f22228822L; 0x07e9c86364648d64L - ; 0xdb12ff2af1f1e3f1L; 0xbfa2e6cc7373d173L; 0x905a248212124812L - ; 0x3a5d807a40401d40L; 0x4028104808082008L; 0x56e89b95c3c32bc3L - ; 0x337bc5dfecec97ecL; 0x9690ab4ddbdb4bdbL; 0x611f5fc0a1a1bea1L - ; 0x1c8307918d8d0e8dL; 0xf5c97ac83d3df43dL; 0xccf1335b97976697L - ; 0x0000000000000000L; 0x36d483f9cfcf1bcfL; 0x4587566e2b2bac2bL - ; 0x97b3ece17676c576L; 0x64b019e682823282L; 0xfea9b128d6d67fd6L - ; 0xd87736c31b1b6c1bL; 0xc15b7774b5b5eeb5L; 0x112943beafaf86afL - ; 0x77dfd41d6a6ab56aL; 0xba0da0ea50505d50L; 0x124c8a5745450945L - ; 0xcb18fb38f3f3ebf3L; 0x9df060ad3030c030L; 0x2b74c3c4efef9befL - ; 0xe5c37eda3f3ffc3fL; 0x921caac755554955L; 0x791059dba2a2b2a2L - ; 0x0365c9e9eaea8feaL; 0x0fecca6a65658965L; 0xb9686903babad2baL - ; 0x65935e4a2f2fbc2fL; 0x4ee79d8ec0c027c0L; 0xbe81a160dede5fdeL - ; 0xe06c38fc1c1c701cL; 0xbb2ee746fdfdd3fdL; 0x52649a1f4d4d294dL - ; 0xe4e0397692927292L; 0x8fbceafa7575c975L; 0x301e0c3606061806L - ; 0x249809ae8a8a128aL; 0xf940794bb2b2f2b2L; 0x6359d185e6e6bfe6L - ; 0x70361c7e0e0e380eL; 0xf8633ee71f1f7c1fL; 0x37f7c45562629562L - ; 0xeea3b53ad4d477d4L; 0x29324d81a8a89aa8L; 0xc4f4315296966296L - ; 0x9b3aef62f9f9c3f9L; 0x66f697a3c5c533c5L; 0x35b14a1025259425L - ; 0xf220b2ab59597959L; 0x54ae15d084842a84L; 0xb7a7e4c57272d572L - ; 0xd5dd72ec3939e439L; 0x5a6198164c4c2d4cL; 0xca3bbc945e5e655eL - ; 0xe785f09f7878fd78L; 0xddd870e53838e038L; 0x148605988c8c0a8cL - ; 0xc6b2bf17d1d163d1L; 0x410b57e4a5a5aea5L; 0x434dd9a1e2e2afe2L - ; 0x2ff8c24e61619961L; 0xf1457b42b3b3f6b3L; 0x15a5423421218421L - ; 0x94d625089c9c4a9cL; 0xf0663cee1e1e781eL; 0x2252866143431143L - ; 0x76fc93b1c7c73bc7L; 0xb32be54ffcfcd7fcL; 0x2014082404041004L - ; 0xb208a2e351515951L; 0xbcc72f2599995e99L; 0x4fc4da226d6da96dL - ; 0x68391a650d0d340dL; 0x8335e979fafacffaL; 0xb684a369dfdf5bdfL - ; 0xd79bfca97e7ee57eL; 0x3db4481924249024L; 0xc5d776fe3b3bec3bL - ; 0x313d4b9aabab96abL; 0x3ed181f0cece1fceL; 0x8855229911114411L - ; 0x0c8903838f8f068fL; 0x4a6b9c044e4e254eL; 0xd1517366b7b7e6b7L - ; 0x0b60cbe0ebeb8bebL; 0xfdcc78c13c3cf03cL; 0x7cbf1ffd81813e81L - ; 0xd4fe354094946a94L; 0xeb0cf31cf7f7fbf7L; 0xa1676f18b9b9deb9L - ; 0x985f268b13134c13L; 0x7d9c58512c2cb02cL; 0xd6b8bb05d3d36bd3L - ; 0x6b5cd38ce7e7bbe7L; 0x57cbdc396e6ea56eL; 0x6ef395aac4c437c4L - ; 0x180f061b03030c03L; 0x8a13acdc56564556L; 0x1a49885e44440d44L - ; 0xdf9efea07f7fe17fL; 0x21374f88a9a99ea9L; 0x4d8254672a2aa82aL - ; 0xb16d6b0abbbbd6bbL; 0x46e29f87c1c123c1L; 0xa202a6f153535153L - ; 0xae8ba572dcdc57dcL; 0x582716530b0b2c0bL; 0x9cd327019d9d4e9dL - ; 0x47c1d82b6c6cad6cL; 0x95f562a43131c431L; 0x87b9e8f37474cd74L - ; 0xe309f115f6f6fff6L; 0x0a438c4c46460546L; 0x092645a5acac8aacL - ; 0x3c970fb589891e89L; 0xa04428b414145014L; 0x5b42dfbae1e1a3e1L - ; 0xb04e2ca616165816L; 0xcdd274f73a3ae83aL; 0x6fd0d2066969b969L - ; 0x482d124109092409L; 0xa7ade0d77070dd70L; 0xd954716fb6b6e2b6L - ; 0xceb7bd1ed0d067d0L; 0x3b7ec7d6eded93edL; 0x2edb85e2cccc17ccL - ; 0x2a57846842421542L; 0xb4c22d2c98985a98L; 0x490e55eda4a4aaa4L - ; 0x5d8850752828a028L; 0xda31b8865c5c6d5cL; 0x933fed6bf8f8c7f8L - ; 0x44a411c286862286L |] - ; [| 0x18c07830d8181860L; 0x2305af462623238cL; 0xc67ef991b8c6c63fL - ; 0xe8136fcdfbe8e887L; 0x874ca113cb878726L; 0xb8a9626d11b8b8daL - ; 0x0108050209010104L; 0x4f426e9e0d4f4f21L; 0x36adee6c9b3636d8L - ; 0xa6590451ffa6a6a2L; 0xd2debdb90cd2d26fL; 0xf5fb06f70ef5f5f3L - ; 0x79ef80f2967979f9L; 0x6f5fcede306f6fa1L; 0x91fcef3f6d91917eL - ; 0x52aa07a4f8525255L; 0x6027fdc04760609dL; 0xbc89766535bcbccaL - ; 0x9baccd2b379b9b56L; 0x8e048c018a8e8e02L; 0xa371155bd2a3a3b6L - ; 0x0c603c186c0c0c30L; 0x7bff8af6847b7bf1L; 0x35b5e16a803535d4L - ; 0x1de8693af51d1d74L; 0xe05347ddb3e0e0a7L; 0xd7f6acb321d7d77bL - ; 0xc25eed999cc2c22fL; 0x2e6d965c432e2eb8L; 0x4b627a96294b4b31L - ; 0xfea321e15dfefedfL; 0x578216aed5575741L; 0x15a8412abd151554L - ; 0x779fb6eee87777c1L; 0x37a5eb6e923737dcL; 0xe57b56d79ee5e5b3L - ; 0x9f8cd923139f9f46L; 0xf0d317fd23f0f0e7L; 0x4a6a7f94204a4a35L - ; 0xda9e95a944dada4fL; 0x58fa25b0a258587dL; 0xc906ca8fcfc9c903L - ; 0x29558d527c2929a4L; 0x0a5022145a0a0a28L; 0xb1e14f7f50b1b1feL - ; 0xa0691a5dc9a0a0baL; 0x6b7fdad6146b6bb1L; 0x855cab17d985852eL - ; 0xbd8173673cbdbdceL; 0x5dd234ba8f5d5d69L; 0x1080502090101040L - ; 0xf4f303f507f4f4f7L; 0xcb16c08bddcbcb0bL; 0x3eedc67cd33e3ef8L - ; 0x0528110a2d050514L; 0x671fe6ce78676781L; 0xe47353d597e4e4b7L - ; 0x2725bb4e0227279cL; 0x4132588273414119L; 0x8b2c9d0ba78b8b16L - ; 0xa7510153f6a7a7a6L; 0x7dcf94fab27d7de9L; 0x95dcfb374995956eL - ; 0xd88e9fad56d8d847L; 0xfb8b30eb70fbfbcbL; 0xee2371c1cdeeee9fL - ; 0x7cc791f8bb7c7cedL; 0x6617e3cc71666685L; 0xdda68ea77bdddd53L - ; 0x17b84b2eaf17175cL; 0x4702468e45474701L; 0x9e84dc211a9e9e42L - ; 0xca1ec589d4caca0fL; 0x2d75995a582d2db4L; 0xbf9179632ebfbfc6L - ; 0x07381b0e3f07071cL; 0xad012347acadad8eL; 0x5aea2fb4b05a5a75L - ; 0x836cb51bef838336L; 0x3385ff66b63333ccL; 0x633ff2c65c636391L - ; 0x02100a0412020208L; 0xaa39384993aaaa92L; 0x71afa8e2de7171d9L - ; 0xc80ecf8dc6c8c807L; 0x19c87d32d1191964L; 0x497270923b494939L - ; 0xd9869aaf5fd9d943L; 0xf2c31df931f2f2efL; 0xe34b48dba8e3e3abL - ; 0x5be22ab6b95b5b71L; 0x8834920dbc88881aL; 0x9aa4c8293e9a9a52L - ; 0x262dbe4c0b262698L; 0x328dfa64bf3232c8L; 0xb0e94a7d59b0b0faL - ; 0xe91b6acff2e9e983L; 0x0f78331e770f0f3cL; 0xd5e6a6b733d5d573L - ; 0x8074ba1df480803aL; 0xbe997c6127bebec2L; 0xcd26de87ebcdcd13L - ; 0x34bde468893434d0L; 0x487a75903248483dL; 0xffab24e354ffffdbL - ; 0x7af78ff48d7a7af5L; 0x90f4ea3d6490907aL; 0x5fc23ebe9d5f5f61L - ; 0x201da0403d202080L; 0x6867d5d00f6868bdL; 0x1ad07234ca1a1a68L - ; 0xae192c41b7aeae82L; 0xb4c95e757db4b4eaL; 0x549a19a8ce54544dL - ; 0x93ece53b7f939376L; 0x220daa442f222288L; 0x6407e9c86364648dL - ; 0xf1db12ff2af1f1e3L; 0x73bfa2e6cc7373d1L; 0x12905a2482121248L - ; 0x403a5d807a40401dL; 0x0840281048080820L; 0xc356e89b95c3c32bL - ; 0xec337bc5dfecec97L; 0xdb9690ab4ddbdb4bL; 0xa1611f5fc0a1a1beL - ; 0x8d1c8307918d8d0eL; 0x3df5c97ac83d3df4L; 0x97ccf1335b979766L - ; 0x0000000000000000L; 0xcf36d483f9cfcf1bL; 0x2b4587566e2b2bacL - ; 0x7697b3ece17676c5L; 0x8264b019e6828232L; 0xd6fea9b128d6d67fL - ; 0x1bd87736c31b1b6cL; 0xb5c15b7774b5b5eeL; 0xaf112943beafaf86L - ; 0x6a77dfd41d6a6ab5L; 0x50ba0da0ea50505dL; 0x45124c8a57454509L - ; 0xf3cb18fb38f3f3ebL; 0x309df060ad3030c0L; 0xef2b74c3c4efef9bL - ; 0x3fe5c37eda3f3ffcL; 0x55921caac7555549L; 0xa2791059dba2a2b2L - ; 0xea0365c9e9eaea8fL; 0x650fecca6a656589L; 0xbab9686903babad2L - ; 0x2f65935e4a2f2fbcL; 0xc04ee79d8ec0c027L; 0xdebe81a160dede5fL - ; 0x1ce06c38fc1c1c70L; 0xfdbb2ee746fdfdd3L; 0x4d52649a1f4d4d29L - ; 0x92e4e03976929272L; 0x758fbceafa7575c9L; 0x06301e0c36060618L - ; 0x8a249809ae8a8a12L; 0xb2f940794bb2b2f2L; 0xe66359d185e6e6bfL - ; 0x0e70361c7e0e0e38L; 0x1ff8633ee71f1f7cL; 0x6237f7c455626295L - ; 0xd4eea3b53ad4d477L; 0xa829324d81a8a89aL; 0x96c4f43152969662L - ; 0xf99b3aef62f9f9c3L; 0xc566f697a3c5c533L; 0x2535b14a10252594L - ; 0x59f220b2ab595979L; 0x8454ae15d084842aL; 0x72b7a7e4c57272d5L - ; 0x39d5dd72ec3939e4L; 0x4c5a6198164c4c2dL; 0x5eca3bbc945e5e65L - ; 0x78e785f09f7878fdL; 0x38ddd870e53838e0L; 0x8c148605988c8c0aL - ; 0xd1c6b2bf17d1d163L; 0xa5410b57e4a5a5aeL; 0xe2434dd9a1e2e2afL - ; 0x612ff8c24e616199L; 0xb3f1457b42b3b3f6L; 0x2115a54234212184L - ; 0x9c94d625089c9c4aL; 0x1ef0663cee1e1e78L; 0x4322528661434311L - ; 0xc776fc93b1c7c73bL; 0xfcb32be54ffcfcd7L; 0x0420140824040410L - ; 0x51b208a2e3515159L; 0x99bcc72f2599995eL; 0x6d4fc4da226d6da9L - ; 0x0d68391a650d0d34L; 0xfa8335e979fafacfL; 0xdfb684a369dfdf5bL - ; 0x7ed79bfca97e7ee5L; 0x243db44819242490L; 0x3bc5d776fe3b3becL - ; 0xab313d4b9aabab96L; 0xce3ed181f0cece1fL; 0x1188552299111144L - ; 0x8f0c8903838f8f06L; 0x4e4a6b9c044e4e25L; 0xb7d1517366b7b7e6L - ; 0xeb0b60cbe0ebeb8bL; 0x3cfdcc78c13c3cf0L; 0x817cbf1ffd81813eL - ; 0x94d4fe354094946aL; 0xf7eb0cf31cf7f7fbL; 0xb9a1676f18b9b9deL - ; 0x13985f268b13134cL; 0x2c7d9c58512c2cb0L; 0xd3d6b8bb05d3d36bL - ; 0xe76b5cd38ce7e7bbL; 0x6e57cbdc396e6ea5L; 0xc46ef395aac4c437L - ; 0x03180f061b03030cL; 0x568a13acdc565645L; 0x441a49885e44440dL - ; 0x7fdf9efea07f7fe1L; 0xa921374f88a9a99eL; 0x2a4d8254672a2aa8L - ; 0xbbb16d6b0abbbbd6L; 0xc146e29f87c1c123L; 0x53a202a6f1535351L - ; 0xdcae8ba572dcdc57L; 0x0b582716530b0b2cL; 0x9d9cd327019d9d4eL - ; 0x6c47c1d82b6c6cadL; 0x3195f562a43131c4L; 0x7487b9e8f37474cdL - ; 0xf6e309f115f6f6ffL; 0x460a438c4c464605L; 0xac092645a5acac8aL - ; 0x893c970fb589891eL; 0x14a04428b4141450L; 0xe15b42dfbae1e1a3L - ; 0x16b04e2ca6161658L; 0x3acdd274f73a3ae8L; 0x696fd0d2066969b9L - ; 0x09482d1241090924L; 0x70a7ade0d77070ddL; 0xb6d954716fb6b6e2L - ; 0xd0ceb7bd1ed0d067L; 0xed3b7ec7d6eded93L; 0xcc2edb85e2cccc17L - ; 0x422a578468424215L; 0x98b4c22d2c98985aL; 0xa4490e55eda4a4aaL - ; 0x285d8850752828a0L; 0x5cda31b8865c5c6dL; 0xf8933fed6bf8f8c7L - ; 0x8644a411c2868622L |] - ; [| 0x6018c07830d81818L; 0x8c2305af46262323L; 0x3fc67ef991b8c6c6L - ; 0x87e8136fcdfbe8e8L; 0x26874ca113cb8787L; 0xdab8a9626d11b8b8L - ; 0x0401080502090101L; 0x214f426e9e0d4f4fL; 0xd836adee6c9b3636L - ; 0xa2a6590451ffa6a6L; 0x6fd2debdb90cd2d2L; 0xf3f5fb06f70ef5f5L - ; 0xf979ef80f2967979L; 0xa16f5fcede306f6fL; 0x7e91fcef3f6d9191L - ; 0x5552aa07a4f85252L; 0x9d6027fdc0476060L; 0xcabc89766535bcbcL - ; 0x569baccd2b379b9bL; 0x028e048c018a8e8eL; 0xb6a371155bd2a3a3L - ; 0x300c603c186c0c0cL; 0xf17bff8af6847b7bL; 0xd435b5e16a803535L - ; 0x741de8693af51d1dL; 0xa7e05347ddb3e0e0L; 0x7bd7f6acb321d7d7L - ; 0x2fc25eed999cc2c2L; 0xb82e6d965c432e2eL; 0x314b627a96294b4bL - ; 0xdffea321e15dfefeL; 0x41578216aed55757L; 0x5415a8412abd1515L - ; 0xc1779fb6eee87777L; 0xdc37a5eb6e923737L; 0xb3e57b56d79ee5e5L - ; 0x469f8cd923139f9fL; 0xe7f0d317fd23f0f0L; 0x354a6a7f94204a4aL - ; 0x4fda9e95a944dadaL; 0x7d58fa25b0a25858L; 0x03c906ca8fcfc9c9L - ; 0xa429558d527c2929L; 0x280a5022145a0a0aL; 0xfeb1e14f7f50b1b1L - ; 0xbaa0691a5dc9a0a0L; 0xb16b7fdad6146b6bL; 0x2e855cab17d98585L - ; 0xcebd8173673cbdbdL; 0x695dd234ba8f5d5dL; 0x4010805020901010L - ; 0xf7f4f303f507f4f4L; 0x0bcb16c08bddcbcbL; 0xf83eedc67cd33e3eL - ; 0x140528110a2d0505L; 0x81671fe6ce786767L; 0xb7e47353d597e4e4L - ; 0x9c2725bb4e022727L; 0x1941325882734141L; 0x168b2c9d0ba78b8bL - ; 0xa6a7510153f6a7a7L; 0xe97dcf94fab27d7dL; 0x6e95dcfb37499595L - ; 0x47d88e9fad56d8d8L; 0xcbfb8b30eb70fbfbL; 0x9fee2371c1cdeeeeL - ; 0xed7cc791f8bb7c7cL; 0x856617e3cc716666L; 0x53dda68ea77bddddL - ; 0x5c17b84b2eaf1717L; 0x014702468e454747L; 0x429e84dc211a9e9eL - ; 0x0fca1ec589d4cacaL; 0xb42d75995a582d2dL; 0xc6bf9179632ebfbfL - ; 0x1c07381b0e3f0707L; 0x8ead012347acadadL; 0x755aea2fb4b05a5aL - ; 0x36836cb51bef8383L; 0xcc3385ff66b63333L; 0x91633ff2c65c6363L - ; 0x0802100a04120202L; 0x92aa39384993aaaaL; 0xd971afa8e2de7171L - ; 0x07c80ecf8dc6c8c8L; 0x6419c87d32d11919L; 0x39497270923b4949L - ; 0x43d9869aaf5fd9d9L; 0xeff2c31df931f2f2L; 0xabe34b48dba8e3e3L - ; 0x715be22ab6b95b5bL; 0x1a8834920dbc8888L; 0x529aa4c8293e9a9aL - ; 0x98262dbe4c0b2626L; 0xc8328dfa64bf3232L; 0xfab0e94a7d59b0b0L - ; 0x83e91b6acff2e9e9L; 0x3c0f78331e770f0fL; 0x73d5e6a6b733d5d5L - ; 0x3a8074ba1df48080L; 0xc2be997c6127bebeL; 0x13cd26de87ebcdcdL - ; 0xd034bde468893434L; 0x3d487a7590324848L; 0xdbffab24e354ffffL - ; 0xf57af78ff48d7a7aL; 0x7a90f4ea3d649090L; 0x615fc23ebe9d5f5fL - ; 0x80201da0403d2020L; 0xbd6867d5d00f6868L; 0x681ad07234ca1a1aL - ; 0x82ae192c41b7aeaeL; 0xeab4c95e757db4b4L; 0x4d549a19a8ce5454L - ; 0x7693ece53b7f9393L; 0x88220daa442f2222L; 0x8d6407e9c8636464L - ; 0xe3f1db12ff2af1f1L; 0xd173bfa2e6cc7373L; 0x4812905a24821212L - ; 0x1d403a5d807a4040L; 0x2008402810480808L; 0x2bc356e89b95c3c3L - ; 0x97ec337bc5dfececL; 0x4bdb9690ab4ddbdbL; 0xbea1611f5fc0a1a1L - ; 0x0e8d1c8307918d8dL; 0xf43df5c97ac83d3dL; 0x6697ccf1335b9797L - ; 0x0000000000000000L; 0x1bcf36d483f9cfcfL; 0xac2b4587566e2b2bL - ; 0xc57697b3ece17676L; 0x328264b019e68282L; 0x7fd6fea9b128d6d6L - ; 0x6c1bd87736c31b1bL; 0xeeb5c15b7774b5b5L; 0x86af112943beafafL - ; 0xb56a77dfd41d6a6aL; 0x5d50ba0da0ea5050L; 0x0945124c8a574545L - ; 0xebf3cb18fb38f3f3L; 0xc0309df060ad3030L; 0x9bef2b74c3c4efefL - ; 0xfc3fe5c37eda3f3fL; 0x4955921caac75555L; 0xb2a2791059dba2a2L - ; 0x8fea0365c9e9eaeaL; 0x89650fecca6a6565L; 0xd2bab9686903babaL - ; 0xbc2f65935e4a2f2fL; 0x27c04ee79d8ec0c0L; 0x5fdebe81a160dedeL - ; 0x701ce06c38fc1c1cL; 0xd3fdbb2ee746fdfdL; 0x294d52649a1f4d4dL - ; 0x7292e4e039769292L; 0xc9758fbceafa7575L; 0x1806301e0c360606L - ; 0x128a249809ae8a8aL; 0xf2b2f940794bb2b2L; 0xbfe66359d185e6e6L - ; 0x380e70361c7e0e0eL; 0x7c1ff8633ee71f1fL; 0x956237f7c4556262L - ; 0x77d4eea3b53ad4d4L; 0x9aa829324d81a8a8L; 0x6296c4f431529696L - ; 0xc3f99b3aef62f9f9L; 0x33c566f697a3c5c5L; 0x942535b14a102525L - ; 0x7959f220b2ab5959L; 0x2a8454ae15d08484L; 0xd572b7a7e4c57272L - ; 0xe439d5dd72ec3939L; 0x2d4c5a6198164c4cL; 0x655eca3bbc945e5eL - ; 0xfd78e785f09f7878L; 0xe038ddd870e53838L; 0x0a8c148605988c8cL - ; 0x63d1c6b2bf17d1d1L; 0xaea5410b57e4a5a5L; 0xafe2434dd9a1e2e2L - ; 0x99612ff8c24e6161L; 0xf6b3f1457b42b3b3L; 0x842115a542342121L - ; 0x4a9c94d625089c9cL; 0x781ef0663cee1e1eL; 0x1143225286614343L - ; 0x3bc776fc93b1c7c7L; 0xd7fcb32be54ffcfcL; 0x1004201408240404L - ; 0x5951b208a2e35151L; 0x5e99bcc72f259999L; 0xa96d4fc4da226d6dL - ; 0x340d68391a650d0dL; 0xcffa8335e979fafaL; 0x5bdfb684a369dfdfL - ; 0xe57ed79bfca97e7eL; 0x90243db448192424L; 0xec3bc5d776fe3b3bL - ; 0x96ab313d4b9aababL; 0x1fce3ed181f0ceceL; 0x4411885522991111L - ; 0x068f0c8903838f8fL; 0x254e4a6b9c044e4eL; 0xe6b7d1517366b7b7L - ; 0x8beb0b60cbe0ebebL; 0xf03cfdcc78c13c3cL; 0x3e817cbf1ffd8181L - ; 0x6a94d4fe35409494L; 0xfbf7eb0cf31cf7f7L; 0xdeb9a1676f18b9b9L - ; 0x4c13985f268b1313L; 0xb02c7d9c58512c2cL; 0x6bd3d6b8bb05d3d3L - ; 0xbbe76b5cd38ce7e7L; 0xa56e57cbdc396e6eL; 0x37c46ef395aac4c4L - ; 0x0c03180f061b0303L; 0x45568a13acdc5656L; 0x0d441a49885e4444L - ; 0xe17fdf9efea07f7fL; 0x9ea921374f88a9a9L; 0xa82a4d8254672a2aL - ; 0xd6bbb16d6b0abbbbL; 0x23c146e29f87c1c1L; 0x5153a202a6f15353L - ; 0x57dcae8ba572dcdcL; 0x2c0b582716530b0bL; 0x4e9d9cd327019d9dL - ; 0xad6c47c1d82b6c6cL; 0xc43195f562a43131L; 0xcd7487b9e8f37474L - ; 0xfff6e309f115f6f6L; 0x05460a438c4c4646L; 0x8aac092645a5acacL - ; 0x1e893c970fb58989L; 0x5014a04428b41414L; 0xa3e15b42dfbae1e1L - ; 0x5816b04e2ca61616L; 0xe83acdd274f73a3aL; 0xb9696fd0d2066969L - ; 0x2409482d12410909L; 0xdd70a7ade0d77070L; 0xe2b6d954716fb6b6L - ; 0x67d0ceb7bd1ed0d0L; 0x93ed3b7ec7d6ededL; 0x17cc2edb85e2ccccL - ; 0x15422a5784684242L; 0x5a98b4c22d2c9898L; 0xaaa4490e55eda4a4L - ; 0xa0285d8850752828L; 0x6d5cda31b8865c5cL; 0xc7f8933fed6bf8f8L - ; 0x228644a411c28686L |] - ; [| 0x186018c07830d818L; 0x238c2305af462623L; 0xc63fc67ef991b8c6L - ; 0xe887e8136fcdfbe8L; 0x8726874ca113cb87L; 0xb8dab8a9626d11b8L - ; 0x0104010805020901L; 0x4f214f426e9e0d4fL; 0x36d836adee6c9b36L - ; 0xa6a2a6590451ffa6L; 0xd26fd2debdb90cd2L; 0xf5f3f5fb06f70ef5L - ; 0x79f979ef80f29679L; 0x6fa16f5fcede306fL; 0x917e91fcef3f6d91L - ; 0x525552aa07a4f852L; 0x609d6027fdc04760L; 0xbccabc89766535bcL - ; 0x9b569baccd2b379bL; 0x8e028e048c018a8eL; 0xa3b6a371155bd2a3L - ; 0x0c300c603c186c0cL; 0x7bf17bff8af6847bL; 0x35d435b5e16a8035L - ; 0x1d741de8693af51dL; 0xe0a7e05347ddb3e0L; 0xd77bd7f6acb321d7L - ; 0xc22fc25eed999cc2L; 0x2eb82e6d965c432eL; 0x4b314b627a96294bL - ; 0xfedffea321e15dfeL; 0x5741578216aed557L; 0x155415a8412abd15L - ; 0x77c1779fb6eee877L; 0x37dc37a5eb6e9237L; 0xe5b3e57b56d79ee5L - ; 0x9f469f8cd923139fL; 0xf0e7f0d317fd23f0L; 0x4a354a6a7f94204aL - ; 0xda4fda9e95a944daL; 0x587d58fa25b0a258L; 0xc903c906ca8fcfc9L - ; 0x29a429558d527c29L; 0x0a280a5022145a0aL; 0xb1feb1e14f7f50b1L - ; 0xa0baa0691a5dc9a0L; 0x6bb16b7fdad6146bL; 0x852e855cab17d985L - ; 0xbdcebd8173673cbdL; 0x5d695dd234ba8f5dL; 0x1040108050209010L - ; 0xf4f7f4f303f507f4L; 0xcb0bcb16c08bddcbL; 0x3ef83eedc67cd33eL - ; 0x05140528110a2d05L; 0x6781671fe6ce7867L; 0xe4b7e47353d597e4L - ; 0x279c2725bb4e0227L; 0x4119413258827341L; 0x8b168b2c9d0ba78bL - ; 0xa7a6a7510153f6a7L; 0x7de97dcf94fab27dL; 0x956e95dcfb374995L - ; 0xd847d88e9fad56d8L; 0xfbcbfb8b30eb70fbL; 0xee9fee2371c1cdeeL - ; 0x7ced7cc791f8bb7cL; 0x66856617e3cc7166L; 0xdd53dda68ea77bddL - ; 0x175c17b84b2eaf17L; 0x47014702468e4547L; 0x9e429e84dc211a9eL - ; 0xca0fca1ec589d4caL; 0x2db42d75995a582dL; 0xbfc6bf9179632ebfL - ; 0x071c07381b0e3f07L; 0xad8ead012347acadL; 0x5a755aea2fb4b05aL - ; 0x8336836cb51bef83L; 0x33cc3385ff66b633L; 0x6391633ff2c65c63L - ; 0x020802100a041202L; 0xaa92aa39384993aaL; 0x71d971afa8e2de71L - ; 0xc807c80ecf8dc6c8L; 0x196419c87d32d119L; 0x4939497270923b49L - ; 0xd943d9869aaf5fd9L; 0xf2eff2c31df931f2L; 0xe3abe34b48dba8e3L - ; 0x5b715be22ab6b95bL; 0x881a8834920dbc88L; 0x9a529aa4c8293e9aL - ; 0x2698262dbe4c0b26L; 0x32c8328dfa64bf32L; 0xb0fab0e94a7d59b0L - ; 0xe983e91b6acff2e9L; 0x0f3c0f78331e770fL; 0xd573d5e6a6b733d5L - ; 0x803a8074ba1df480L; 0xbec2be997c6127beL; 0xcd13cd26de87ebcdL - ; 0x34d034bde4688934L; 0x483d487a75903248L; 0xffdbffab24e354ffL - ; 0x7af57af78ff48d7aL; 0x907a90f4ea3d6490L; 0x5f615fc23ebe9d5fL - ; 0x2080201da0403d20L; 0x68bd6867d5d00f68L; 0x1a681ad07234ca1aL - ; 0xae82ae192c41b7aeL; 0xb4eab4c95e757db4L; 0x544d549a19a8ce54L - ; 0x937693ece53b7f93L; 0x2288220daa442f22L; 0x648d6407e9c86364L - ; 0xf1e3f1db12ff2af1L; 0x73d173bfa2e6cc73L; 0x124812905a248212L - ; 0x401d403a5d807a40L; 0x0820084028104808L; 0xc32bc356e89b95c3L - ; 0xec97ec337bc5dfecL; 0xdb4bdb9690ab4ddbL; 0xa1bea1611f5fc0a1L - ; 0x8d0e8d1c8307918dL; 0x3df43df5c97ac83dL; 0x976697ccf1335b97L - ; 0x0000000000000000L; 0xcf1bcf36d483f9cfL; 0x2bac2b4587566e2bL - ; 0x76c57697b3ece176L; 0x82328264b019e682L; 0xd67fd6fea9b128d6L - ; 0x1b6c1bd87736c31bL; 0xb5eeb5c15b7774b5L; 0xaf86af112943beafL - ; 0x6ab56a77dfd41d6aL; 0x505d50ba0da0ea50L; 0x450945124c8a5745L - ; 0xf3ebf3cb18fb38f3L; 0x30c0309df060ad30L; 0xef9bef2b74c3c4efL - ; 0x3ffc3fe5c37eda3fL; 0x554955921caac755L; 0xa2b2a2791059dba2L - ; 0xea8fea0365c9e9eaL; 0x6589650fecca6a65L; 0xbad2bab9686903baL - ; 0x2fbc2f65935e4a2fL; 0xc027c04ee79d8ec0L; 0xde5fdebe81a160deL - ; 0x1c701ce06c38fc1cL; 0xfdd3fdbb2ee746fdL; 0x4d294d52649a1f4dL - ; 0x927292e4e0397692L; 0x75c9758fbceafa75L; 0x061806301e0c3606L - ; 0x8a128a249809ae8aL; 0xb2f2b2f940794bb2L; 0xe6bfe66359d185e6L - ; 0x0e380e70361c7e0eL; 0x1f7c1ff8633ee71fL; 0x62956237f7c45562L - ; 0xd477d4eea3b53ad4L; 0xa89aa829324d81a8L; 0x966296c4f4315296L - ; 0xf9c3f99b3aef62f9L; 0xc533c566f697a3c5L; 0x25942535b14a1025L - ; 0x597959f220b2ab59L; 0x842a8454ae15d084L; 0x72d572b7a7e4c572L - ; 0x39e439d5dd72ec39L; 0x4c2d4c5a6198164cL; 0x5e655eca3bbc945eL - ; 0x78fd78e785f09f78L; 0x38e038ddd870e538L; 0x8c0a8c148605988cL - ; 0xd163d1c6b2bf17d1L; 0xa5aea5410b57e4a5L; 0xe2afe2434dd9a1e2L - ; 0x6199612ff8c24e61L; 0xb3f6b3f1457b42b3L; 0x21842115a5423421L - ; 0x9c4a9c94d625089cL; 0x1e781ef0663cee1eL; 0x4311432252866143L - ; 0xc73bc776fc93b1c7L; 0xfcd7fcb32be54ffcL; 0x0410042014082404L - ; 0x515951b208a2e351L; 0x995e99bcc72f2599L; 0x6da96d4fc4da226dL - ; 0x0d340d68391a650dL; 0xfacffa8335e979faL; 0xdf5bdfb684a369dfL - ; 0x7ee57ed79bfca97eL; 0x2490243db4481924L; 0x3bec3bc5d776fe3bL - ; 0xab96ab313d4b9aabL; 0xce1fce3ed181f0ceL; 0x1144118855229911L - ; 0x8f068f0c8903838fL; 0x4e254e4a6b9c044eL; 0xb7e6b7d1517366b7L - ; 0xeb8beb0b60cbe0ebL; 0x3cf03cfdcc78c13cL; 0x813e817cbf1ffd81L - ; 0x946a94d4fe354094L; 0xf7fbf7eb0cf31cf7L; 0xb9deb9a1676f18b9L - ; 0x134c13985f268b13L; 0x2cb02c7d9c58512cL; 0xd36bd3d6b8bb05d3L - ; 0xe7bbe76b5cd38ce7L; 0x6ea56e57cbdc396eL; 0xc437c46ef395aac4L - ; 0x030c03180f061b03L; 0x5645568a13acdc56L; 0x440d441a49885e44L - ; 0x7fe17fdf9efea07fL; 0xa99ea921374f88a9L; 0x2aa82a4d8254672aL - ; 0xbbd6bbb16d6b0abbL; 0xc123c146e29f87c1L; 0x535153a202a6f153L - ; 0xdc57dcae8ba572dcL; 0x0b2c0b582716530bL; 0x9d4e9d9cd327019dL - ; 0x6cad6c47c1d82b6cL; 0x31c43195f562a431L; 0x74cd7487b9e8f374L - ; 0xf6fff6e309f115f6L; 0x4605460a438c4c46L; 0xac8aac092645a5acL - ; 0x891e893c970fb589L; 0x145014a04428b414L; 0xe1a3e15b42dfbae1L - ; 0x165816b04e2ca616L; 0x3ae83acdd274f73aL; 0x69b9696fd0d20669L - ; 0x092409482d124109L; 0x70dd70a7ade0d770L; 0xb6e2b6d954716fb6L - ; 0xd067d0ceb7bd1ed0L; 0xed93ed3b7ec7d6edL; 0xcc17cc2edb85e2ccL - ; 0x4215422a57846842L; 0x985a98b4c22d2c98L; 0xa4aaa4490e55eda4L - ; 0x28a0285d88507528L; 0x5c6d5cda31b8865cL; 0xf8c7f8933fed6bf8L - ; 0x86228644a411c286L |] |] + [| + [| + 0x18186018c07830d8L; + 0x23238c2305af4626L; + 0xc6c63fc67ef991b8L; + 0xe8e887e8136fcdfbL; + 0x878726874ca113cbL; + 0xb8b8dab8a9626d11L; + 0x0101040108050209L; + 0x4f4f214f426e9e0dL; + 0x3636d836adee6c9bL; + 0xa6a6a2a6590451ffL; + 0xd2d26fd2debdb90cL; + 0xf5f5f3f5fb06f70eL; + 0x7979f979ef80f296L; + 0x6f6fa16f5fcede30L; + 0x91917e91fcef3f6dL; + 0x52525552aa07a4f8L; + 0x60609d6027fdc047L; + 0xbcbccabc89766535L; + 0x9b9b569baccd2b37L; + 0x8e8e028e048c018aL; + 0xa3a3b6a371155bd2L; + 0x0c0c300c603c186cL; + 0x7b7bf17bff8af684L; + 0x3535d435b5e16a80L; + 0x1d1d741de8693af5L; + 0xe0e0a7e05347ddb3L; + 0xd7d77bd7f6acb321L; + 0xc2c22fc25eed999cL; + 0x2e2eb82e6d965c43L; + 0x4b4b314b627a9629L; + 0xfefedffea321e15dL; + 0x575741578216aed5L; + 0x15155415a8412abdL; + 0x7777c1779fb6eee8L; + 0x3737dc37a5eb6e92L; + 0xe5e5b3e57b56d79eL; + 0x9f9f469f8cd92313L; + 0xf0f0e7f0d317fd23L; + 0x4a4a354a6a7f9420L; + 0xdada4fda9e95a944L; + 0x58587d58fa25b0a2L; + 0xc9c903c906ca8fcfL; + 0x2929a429558d527cL; + 0x0a0a280a5022145aL; + 0xb1b1feb1e14f7f50L; + 0xa0a0baa0691a5dc9L; + 0x6b6bb16b7fdad614L; + 0x85852e855cab17d9L; + 0xbdbdcebd8173673cL; + 0x5d5d695dd234ba8fL; + 0x1010401080502090L; + 0xf4f4f7f4f303f507L; + 0xcbcb0bcb16c08bddL; + 0x3e3ef83eedc67cd3L; + 0x0505140528110a2dL; + 0x676781671fe6ce78L; + 0xe4e4b7e47353d597L; + 0x27279c2725bb4e02L; + 0x4141194132588273L; + 0x8b8b168b2c9d0ba7L; + 0xa7a7a6a7510153f6L; + 0x7d7de97dcf94fab2L; + 0x95956e95dcfb3749L; + 0xd8d847d88e9fad56L; + 0xfbfbcbfb8b30eb70L; + 0xeeee9fee2371c1cdL; + 0x7c7ced7cc791f8bbL; + 0x6666856617e3cc71L; + 0xdddd53dda68ea77bL; + 0x17175c17b84b2eafL; + 0x4747014702468e45L; + 0x9e9e429e84dc211aL; + 0xcaca0fca1ec589d4L; + 0x2d2db42d75995a58L; + 0xbfbfc6bf9179632eL; + 0x07071c07381b0e3fL; + 0xadad8ead012347acL; + 0x5a5a755aea2fb4b0L; + 0x838336836cb51befL; + 0x3333cc3385ff66b6L; + 0x636391633ff2c65cL; + 0x02020802100a0412L; + 0xaaaa92aa39384993L; + 0x7171d971afa8e2deL; + 0xc8c807c80ecf8dc6L; + 0x19196419c87d32d1L; + 0x494939497270923bL; + 0xd9d943d9869aaf5fL; + 0xf2f2eff2c31df931L; + 0xe3e3abe34b48dba8L; + 0x5b5b715be22ab6b9L; + 0x88881a8834920dbcL; + 0x9a9a529aa4c8293eL; + 0x262698262dbe4c0bL; + 0x3232c8328dfa64bfL; + 0xb0b0fab0e94a7d59L; + 0xe9e983e91b6acff2L; + 0x0f0f3c0f78331e77L; + 0xd5d573d5e6a6b733L; + 0x80803a8074ba1df4L; + 0xbebec2be997c6127L; + 0xcdcd13cd26de87ebL; + 0x3434d034bde46889L; + 0x48483d487a759032L; + 0xffffdbffab24e354L; + 0x7a7af57af78ff48dL; + 0x90907a90f4ea3d64L; + 0x5f5f615fc23ebe9dL; + 0x202080201da0403dL; + 0x6868bd6867d5d00fL; + 0x1a1a681ad07234caL; + 0xaeae82ae192c41b7L; + 0xb4b4eab4c95e757dL; + 0x54544d549a19a8ceL; + 0x93937693ece53b7fL; + 0x222288220daa442fL; + 0x64648d6407e9c863L; + 0xf1f1e3f1db12ff2aL; + 0x7373d173bfa2e6ccL; + 0x12124812905a2482L; + 0x40401d403a5d807aL; + 0x0808200840281048L; + 0xc3c32bc356e89b95L; + 0xecec97ec337bc5dfL; + 0xdbdb4bdb9690ab4dL; + 0xa1a1bea1611f5fc0L; + 0x8d8d0e8d1c830791L; + 0x3d3df43df5c97ac8L; + 0x97976697ccf1335bL; + 0x0000000000000000L; + 0xcfcf1bcf36d483f9L; + 0x2b2bac2b4587566eL; + 0x7676c57697b3ece1L; + 0x8282328264b019e6L; + 0xd6d67fd6fea9b128L; + 0x1b1b6c1bd87736c3L; + 0xb5b5eeb5c15b7774L; + 0xafaf86af112943beL; + 0x6a6ab56a77dfd41dL; + 0x50505d50ba0da0eaL; + 0x45450945124c8a57L; + 0xf3f3ebf3cb18fb38L; + 0x3030c0309df060adL; + 0xefef9bef2b74c3c4L; + 0x3f3ffc3fe5c37edaL; + 0x55554955921caac7L; + 0xa2a2b2a2791059dbL; + 0xeaea8fea0365c9e9L; + 0x656589650fecca6aL; + 0xbabad2bab9686903L; + 0x2f2fbc2f65935e4aL; + 0xc0c027c04ee79d8eL; + 0xdede5fdebe81a160L; + 0x1c1c701ce06c38fcL; + 0xfdfdd3fdbb2ee746L; + 0x4d4d294d52649a1fL; + 0x92927292e4e03976L; + 0x7575c9758fbceafaL; + 0x06061806301e0c36L; + 0x8a8a128a249809aeL; + 0xb2b2f2b2f940794bL; + 0xe6e6bfe66359d185L; + 0x0e0e380e70361c7eL; + 0x1f1f7c1ff8633ee7L; + 0x6262956237f7c455L; + 0xd4d477d4eea3b53aL; + 0xa8a89aa829324d81L; + 0x96966296c4f43152L; + 0xf9f9c3f99b3aef62L; + 0xc5c533c566f697a3L; + 0x2525942535b14a10L; + 0x59597959f220b2abL; + 0x84842a8454ae15d0L; + 0x7272d572b7a7e4c5L; + 0x3939e439d5dd72ecL; + 0x4c4c2d4c5a619816L; + 0x5e5e655eca3bbc94L; + 0x7878fd78e785f09fL; + 0x3838e038ddd870e5L; + 0x8c8c0a8c14860598L; + 0xd1d163d1c6b2bf17L; + 0xa5a5aea5410b57e4L; + 0xe2e2afe2434dd9a1L; + 0x616199612ff8c24eL; + 0xb3b3f6b3f1457b42L; + 0x2121842115a54234L; + 0x9c9c4a9c94d62508L; + 0x1e1e781ef0663ceeL; + 0x4343114322528661L; + 0xc7c73bc776fc93b1L; + 0xfcfcd7fcb32be54fL; + 0x0404100420140824L; + 0x51515951b208a2e3L; + 0x99995e99bcc72f25L; + 0x6d6da96d4fc4da22L; + 0x0d0d340d68391a65L; + 0xfafacffa8335e979L; + 0xdfdf5bdfb684a369L; + 0x7e7ee57ed79bfca9L; + 0x242490243db44819L; + 0x3b3bec3bc5d776feL; + 0xabab96ab313d4b9aL; + 0xcece1fce3ed181f0L; + 0x1111441188552299L; + 0x8f8f068f0c890383L; + 0x4e4e254e4a6b9c04L; + 0xb7b7e6b7d1517366L; + 0xebeb8beb0b60cbe0L; + 0x3c3cf03cfdcc78c1L; + 0x81813e817cbf1ffdL; + 0x94946a94d4fe3540L; + 0xf7f7fbf7eb0cf31cL; + 0xb9b9deb9a1676f18L; + 0x13134c13985f268bL; + 0x2c2cb02c7d9c5851L; + 0xd3d36bd3d6b8bb05L; + 0xe7e7bbe76b5cd38cL; + 0x6e6ea56e57cbdc39L; + 0xc4c437c46ef395aaL; + 0x03030c03180f061bL; + 0x565645568a13acdcL; + 0x44440d441a49885eL; + 0x7f7fe17fdf9efea0L; + 0xa9a99ea921374f88L; + 0x2a2aa82a4d825467L; + 0xbbbbd6bbb16d6b0aL; + 0xc1c123c146e29f87L; + 0x53535153a202a6f1L; + 0xdcdc57dcae8ba572L; + 0x0b0b2c0b58271653L; + 0x9d9d4e9d9cd32701L; + 0x6c6cad6c47c1d82bL; + 0x3131c43195f562a4L; + 0x7474cd7487b9e8f3L; + 0xf6f6fff6e309f115L; + 0x464605460a438c4cL; + 0xacac8aac092645a5L; + 0x89891e893c970fb5L; + 0x14145014a04428b4L; + 0xe1e1a3e15b42dfbaL; + 0x16165816b04e2ca6L; + 0x3a3ae83acdd274f7L; + 0x6969b9696fd0d206L; + 0x09092409482d1241L; + 0x7070dd70a7ade0d7L; + 0xb6b6e2b6d954716fL; + 0xd0d067d0ceb7bd1eL; + 0xeded93ed3b7ec7d6L; + 0xcccc17cc2edb85e2L; + 0x424215422a578468L; + 0x98985a98b4c22d2cL; + 0xa4a4aaa4490e55edL; + 0x2828a0285d885075L; + 0x5c5c6d5cda31b886L; + 0xf8f8c7f8933fed6bL; + 0x8686228644a411c2L; + |]; + [| + 0xd818186018c07830L; + 0x2623238c2305af46L; + 0xb8c6c63fc67ef991L; + 0xfbe8e887e8136fcdL; + 0xcb878726874ca113L; + 0x11b8b8dab8a9626dL; + 0x0901010401080502L; + 0x0d4f4f214f426e9eL; + 0x9b3636d836adee6cL; + 0xffa6a6a2a6590451L; + 0x0cd2d26fd2debdb9L; + 0x0ef5f5f3f5fb06f7L; + 0x967979f979ef80f2L; + 0x306f6fa16f5fcedeL; + 0x6d91917e91fcef3fL; + 0xf852525552aa07a4L; + 0x4760609d6027fdc0L; + 0x35bcbccabc897665L; + 0x379b9b569baccd2bL; + 0x8a8e8e028e048c01L; + 0xd2a3a3b6a371155bL; + 0x6c0c0c300c603c18L; + 0x847b7bf17bff8af6L; + 0x803535d435b5e16aL; + 0xf51d1d741de8693aL; + 0xb3e0e0a7e05347ddL; + 0x21d7d77bd7f6acb3L; + 0x9cc2c22fc25eed99L; + 0x432e2eb82e6d965cL; + 0x294b4b314b627a96L; + 0x5dfefedffea321e1L; + 0xd5575741578216aeL; + 0xbd15155415a8412aL; + 0xe87777c1779fb6eeL; + 0x923737dc37a5eb6eL; + 0x9ee5e5b3e57b56d7L; + 0x139f9f469f8cd923L; + 0x23f0f0e7f0d317fdL; + 0x204a4a354a6a7f94L; + 0x44dada4fda9e95a9L; + 0xa258587d58fa25b0L; + 0xcfc9c903c906ca8fL; + 0x7c2929a429558d52L; + 0x5a0a0a280a502214L; + 0x50b1b1feb1e14f7fL; + 0xc9a0a0baa0691a5dL; + 0x146b6bb16b7fdad6L; + 0xd985852e855cab17L; + 0x3cbdbdcebd817367L; + 0x8f5d5d695dd234baL; + 0x9010104010805020L; + 0x07f4f4f7f4f303f5L; + 0xddcbcb0bcb16c08bL; + 0xd33e3ef83eedc67cL; + 0x2d0505140528110aL; + 0x78676781671fe6ceL; + 0x97e4e4b7e47353d5L; + 0x0227279c2725bb4eL; + 0x7341411941325882L; + 0xa78b8b168b2c9d0bL; + 0xf6a7a7a6a7510153L; + 0xb27d7de97dcf94faL; + 0x4995956e95dcfb37L; + 0x56d8d847d88e9fadL; + 0x70fbfbcbfb8b30ebL; + 0xcdeeee9fee2371c1L; + 0xbb7c7ced7cc791f8L; + 0x716666856617e3ccL; + 0x7bdddd53dda68ea7L; + 0xaf17175c17b84b2eL; + 0x454747014702468eL; + 0x1a9e9e429e84dc21L; + 0xd4caca0fca1ec589L; + 0x582d2db42d75995aL; + 0x2ebfbfc6bf917963L; + 0x3f07071c07381b0eL; + 0xacadad8ead012347L; + 0xb05a5a755aea2fb4L; + 0xef838336836cb51bL; + 0xb63333cc3385ff66L; + 0x5c636391633ff2c6L; + 0x1202020802100a04L; + 0x93aaaa92aa393849L; + 0xde7171d971afa8e2L; + 0xc6c8c807c80ecf8dL; + 0xd119196419c87d32L; + 0x3b49493949727092L; + 0x5fd9d943d9869aafL; + 0x31f2f2eff2c31df9L; + 0xa8e3e3abe34b48dbL; + 0xb95b5b715be22ab6L; + 0xbc88881a8834920dL; + 0x3e9a9a529aa4c829L; + 0x0b262698262dbe4cL; + 0xbf3232c8328dfa64L; + 0x59b0b0fab0e94a7dL; + 0xf2e9e983e91b6acfL; + 0x770f0f3c0f78331eL; + 0x33d5d573d5e6a6b7L; + 0xf480803a8074ba1dL; + 0x27bebec2be997c61L; + 0xebcdcd13cd26de87L; + 0x893434d034bde468L; + 0x3248483d487a7590L; + 0x54ffffdbffab24e3L; + 0x8d7a7af57af78ff4L; + 0x6490907a90f4ea3dL; + 0x9d5f5f615fc23ebeL; + 0x3d202080201da040L; + 0x0f6868bd6867d5d0L; + 0xca1a1a681ad07234L; + 0xb7aeae82ae192c41L; + 0x7db4b4eab4c95e75L; + 0xce54544d549a19a8L; + 0x7f93937693ece53bL; + 0x2f222288220daa44L; + 0x6364648d6407e9c8L; + 0x2af1f1e3f1db12ffL; + 0xcc7373d173bfa2e6L; + 0x8212124812905a24L; + 0x7a40401d403a5d80L; + 0x4808082008402810L; + 0x95c3c32bc356e89bL; + 0xdfecec97ec337bc5L; + 0x4ddbdb4bdb9690abL; + 0xc0a1a1bea1611f5fL; + 0x918d8d0e8d1c8307L; + 0xc83d3df43df5c97aL; + 0x5b97976697ccf133L; + 0x0000000000000000L; + 0xf9cfcf1bcf36d483L; + 0x6e2b2bac2b458756L; + 0xe17676c57697b3ecL; + 0xe68282328264b019L; + 0x28d6d67fd6fea9b1L; + 0xc31b1b6c1bd87736L; + 0x74b5b5eeb5c15b77L; + 0xbeafaf86af112943L; + 0x1d6a6ab56a77dfd4L; + 0xea50505d50ba0da0L; + 0x5745450945124c8aL; + 0x38f3f3ebf3cb18fbL; + 0xad3030c0309df060L; + 0xc4efef9bef2b74c3L; + 0xda3f3ffc3fe5c37eL; + 0xc755554955921caaL; + 0xdba2a2b2a2791059L; + 0xe9eaea8fea0365c9L; + 0x6a656589650feccaL; + 0x03babad2bab96869L; + 0x4a2f2fbc2f65935eL; + 0x8ec0c027c04ee79dL; + 0x60dede5fdebe81a1L; + 0xfc1c1c701ce06c38L; + 0x46fdfdd3fdbb2ee7L; + 0x1f4d4d294d52649aL; + 0x7692927292e4e039L; + 0xfa7575c9758fbceaL; + 0x3606061806301e0cL; + 0xae8a8a128a249809L; + 0x4bb2b2f2b2f94079L; + 0x85e6e6bfe66359d1L; + 0x7e0e0e380e70361cL; + 0xe71f1f7c1ff8633eL; + 0x556262956237f7c4L; + 0x3ad4d477d4eea3b5L; + 0x81a8a89aa829324dL; + 0x5296966296c4f431L; + 0x62f9f9c3f99b3aefL; + 0xa3c5c533c566f697L; + 0x102525942535b14aL; + 0xab59597959f220b2L; + 0xd084842a8454ae15L; + 0xc57272d572b7a7e4L; + 0xec3939e439d5dd72L; + 0x164c4c2d4c5a6198L; + 0x945e5e655eca3bbcL; + 0x9f7878fd78e785f0L; + 0xe53838e038ddd870L; + 0x988c8c0a8c148605L; + 0x17d1d163d1c6b2bfL; + 0xe4a5a5aea5410b57L; + 0xa1e2e2afe2434dd9L; + 0x4e616199612ff8c2L; + 0x42b3b3f6b3f1457bL; + 0x342121842115a542L; + 0x089c9c4a9c94d625L; + 0xee1e1e781ef0663cL; + 0x6143431143225286L; + 0xb1c7c73bc776fc93L; + 0x4ffcfcd7fcb32be5L; + 0x2404041004201408L; + 0xe351515951b208a2L; + 0x2599995e99bcc72fL; + 0x226d6da96d4fc4daL; + 0x650d0d340d68391aL; + 0x79fafacffa8335e9L; + 0x69dfdf5bdfb684a3L; + 0xa97e7ee57ed79bfcL; + 0x19242490243db448L; + 0xfe3b3bec3bc5d776L; + 0x9aabab96ab313d4bL; + 0xf0cece1fce3ed181L; + 0x9911114411885522L; + 0x838f8f068f0c8903L; + 0x044e4e254e4a6b9cL; + 0x66b7b7e6b7d15173L; + 0xe0ebeb8beb0b60cbL; + 0xc13c3cf03cfdcc78L; + 0xfd81813e817cbf1fL; + 0x4094946a94d4fe35L; + 0x1cf7f7fbf7eb0cf3L; + 0x18b9b9deb9a1676fL; + 0x8b13134c13985f26L; + 0x512c2cb02c7d9c58L; + 0x05d3d36bd3d6b8bbL; + 0x8ce7e7bbe76b5cd3L; + 0x396e6ea56e57cbdcL; + 0xaac4c437c46ef395L; + 0x1b03030c03180f06L; + 0xdc565645568a13acL; + 0x5e44440d441a4988L; + 0xa07f7fe17fdf9efeL; + 0x88a9a99ea921374fL; + 0x672a2aa82a4d8254L; + 0x0abbbbd6bbb16d6bL; + 0x87c1c123c146e29fL; + 0xf153535153a202a6L; + 0x72dcdc57dcae8ba5L; + 0x530b0b2c0b582716L; + 0x019d9d4e9d9cd327L; + 0x2b6c6cad6c47c1d8L; + 0xa43131c43195f562L; + 0xf37474cd7487b9e8L; + 0x15f6f6fff6e309f1L; + 0x4c464605460a438cL; + 0xa5acac8aac092645L; + 0xb589891e893c970fL; + 0xb414145014a04428L; + 0xbae1e1a3e15b42dfL; + 0xa616165816b04e2cL; + 0xf73a3ae83acdd274L; + 0x066969b9696fd0d2L; + 0x4109092409482d12L; + 0xd77070dd70a7ade0L; + 0x6fb6b6e2b6d95471L; + 0x1ed0d067d0ceb7bdL; + 0xd6eded93ed3b7ec7L; + 0xe2cccc17cc2edb85L; + 0x68424215422a5784L; + 0x2c98985a98b4c22dL; + 0xeda4a4aaa4490e55L; + 0x752828a0285d8850L; + 0x865c5c6d5cda31b8L; + 0x6bf8f8c7f8933fedL; + 0xc28686228644a411L; + |]; + [| + 0x30d818186018c078L; + 0x462623238c2305afL; + 0x91b8c6c63fc67ef9L; + 0xcdfbe8e887e8136fL; + 0x13cb878726874ca1L; + 0x6d11b8b8dab8a962L; + 0x0209010104010805L; + 0x9e0d4f4f214f426eL; + 0x6c9b3636d836adeeL; + 0x51ffa6a6a2a65904L; + 0xb90cd2d26fd2debdL; + 0xf70ef5f5f3f5fb06L; + 0xf2967979f979ef80L; + 0xde306f6fa16f5fceL; + 0x3f6d91917e91fcefL; + 0xa4f852525552aa07L; + 0xc04760609d6027fdL; + 0x6535bcbccabc8976L; + 0x2b379b9b569baccdL; + 0x018a8e8e028e048cL; + 0x5bd2a3a3b6a37115L; + 0x186c0c0c300c603cL; + 0xf6847b7bf17bff8aL; + 0x6a803535d435b5e1L; + 0x3af51d1d741de869L; + 0xddb3e0e0a7e05347L; + 0xb321d7d77bd7f6acL; + 0x999cc2c22fc25eedL; + 0x5c432e2eb82e6d96L; + 0x96294b4b314b627aL; + 0xe15dfefedffea321L; + 0xaed5575741578216L; + 0x2abd15155415a841L; + 0xeee87777c1779fb6L; + 0x6e923737dc37a5ebL; + 0xd79ee5e5b3e57b56L; + 0x23139f9f469f8cd9L; + 0xfd23f0f0e7f0d317L; + 0x94204a4a354a6a7fL; + 0xa944dada4fda9e95L; + 0xb0a258587d58fa25L; + 0x8fcfc9c903c906caL; + 0x527c2929a429558dL; + 0x145a0a0a280a5022L; + 0x7f50b1b1feb1e14fL; + 0x5dc9a0a0baa0691aL; + 0xd6146b6bb16b7fdaL; + 0x17d985852e855cabL; + 0x673cbdbdcebd8173L; + 0xba8f5d5d695dd234L; + 0x2090101040108050L; + 0xf507f4f4f7f4f303L; + 0x8bddcbcb0bcb16c0L; + 0x7cd33e3ef83eedc6L; + 0x0a2d050514052811L; + 0xce78676781671fe6L; + 0xd597e4e4b7e47353L; + 0x4e0227279c2725bbL; + 0x8273414119413258L; + 0x0ba78b8b168b2c9dL; + 0x53f6a7a7a6a75101L; + 0xfab27d7de97dcf94L; + 0x374995956e95dcfbL; + 0xad56d8d847d88e9fL; + 0xeb70fbfbcbfb8b30L; + 0xc1cdeeee9fee2371L; + 0xf8bb7c7ced7cc791L; + 0xcc716666856617e3L; + 0xa77bdddd53dda68eL; + 0x2eaf17175c17b84bL; + 0x8e45474701470246L; + 0x211a9e9e429e84dcL; + 0x89d4caca0fca1ec5L; + 0x5a582d2db42d7599L; + 0x632ebfbfc6bf9179L; + 0x0e3f07071c07381bL; + 0x47acadad8ead0123L; + 0xb4b05a5a755aea2fL; + 0x1bef838336836cb5L; + 0x66b63333cc3385ffL; + 0xc65c636391633ff2L; + 0x041202020802100aL; + 0x4993aaaa92aa3938L; + 0xe2de7171d971afa8L; + 0x8dc6c8c807c80ecfL; + 0x32d119196419c87dL; + 0x923b494939497270L; + 0xaf5fd9d943d9869aL; + 0xf931f2f2eff2c31dL; + 0xdba8e3e3abe34b48L; + 0xb6b95b5b715be22aL; + 0x0dbc88881a883492L; + 0x293e9a9a529aa4c8L; + 0x4c0b262698262dbeL; + 0x64bf3232c8328dfaL; + 0x7d59b0b0fab0e94aL; + 0xcff2e9e983e91b6aL; + 0x1e770f0f3c0f7833L; + 0xb733d5d573d5e6a6L; + 0x1df480803a8074baL; + 0x6127bebec2be997cL; + 0x87ebcdcd13cd26deL; + 0x68893434d034bde4L; + 0x903248483d487a75L; + 0xe354ffffdbffab24L; + 0xf48d7a7af57af78fL; + 0x3d6490907a90f4eaL; + 0xbe9d5f5f615fc23eL; + 0x403d202080201da0L; + 0xd00f6868bd6867d5L; + 0x34ca1a1a681ad072L; + 0x41b7aeae82ae192cL; + 0x757db4b4eab4c95eL; + 0xa8ce54544d549a19L; + 0x3b7f93937693ece5L; + 0x442f222288220daaL; + 0xc86364648d6407e9L; + 0xff2af1f1e3f1db12L; + 0xe6cc7373d173bfa2L; + 0x248212124812905aL; + 0x807a40401d403a5dL; + 0x1048080820084028L; + 0x9b95c3c32bc356e8L; + 0xc5dfecec97ec337bL; + 0xab4ddbdb4bdb9690L; + 0x5fc0a1a1bea1611fL; + 0x07918d8d0e8d1c83L; + 0x7ac83d3df43df5c9L; + 0x335b97976697ccf1L; + 0x0000000000000000L; + 0x83f9cfcf1bcf36d4L; + 0x566e2b2bac2b4587L; + 0xece17676c57697b3L; + 0x19e68282328264b0L; + 0xb128d6d67fd6fea9L; + 0x36c31b1b6c1bd877L; + 0x7774b5b5eeb5c15bL; + 0x43beafaf86af1129L; + 0xd41d6a6ab56a77dfL; + 0xa0ea50505d50ba0dL; + 0x8a5745450945124cL; + 0xfb38f3f3ebf3cb18L; + 0x60ad3030c0309df0L; + 0xc3c4efef9bef2b74L; + 0x7eda3f3ffc3fe5c3L; + 0xaac755554955921cL; + 0x59dba2a2b2a27910L; + 0xc9e9eaea8fea0365L; + 0xca6a656589650fecL; + 0x6903babad2bab968L; + 0x5e4a2f2fbc2f6593L; + 0x9d8ec0c027c04ee7L; + 0xa160dede5fdebe81L; + 0x38fc1c1c701ce06cL; + 0xe746fdfdd3fdbb2eL; + 0x9a1f4d4d294d5264L; + 0x397692927292e4e0L; + 0xeafa7575c9758fbcL; + 0x0c3606061806301eL; + 0x09ae8a8a128a2498L; + 0x794bb2b2f2b2f940L; + 0xd185e6e6bfe66359L; + 0x1c7e0e0e380e7036L; + 0x3ee71f1f7c1ff863L; + 0xc4556262956237f7L; + 0xb53ad4d477d4eea3L; + 0x4d81a8a89aa82932L; + 0x315296966296c4f4L; + 0xef62f9f9c3f99b3aL; + 0x97a3c5c533c566f6L; + 0x4a102525942535b1L; + 0xb2ab59597959f220L; + 0x15d084842a8454aeL; + 0xe4c57272d572b7a7L; + 0x72ec3939e439d5ddL; + 0x98164c4c2d4c5a61L; + 0xbc945e5e655eca3bL; + 0xf09f7878fd78e785L; + 0x70e53838e038ddd8L; + 0x05988c8c0a8c1486L; + 0xbf17d1d163d1c6b2L; + 0x57e4a5a5aea5410bL; + 0xd9a1e2e2afe2434dL; + 0xc24e616199612ff8L; + 0x7b42b3b3f6b3f145L; + 0x42342121842115a5L; + 0x25089c9c4a9c94d6L; + 0x3cee1e1e781ef066L; + 0x8661434311432252L; + 0x93b1c7c73bc776fcL; + 0xe54ffcfcd7fcb32bL; + 0x0824040410042014L; + 0xa2e351515951b208L; + 0x2f2599995e99bcc7L; + 0xda226d6da96d4fc4L; + 0x1a650d0d340d6839L; + 0xe979fafacffa8335L; + 0xa369dfdf5bdfb684L; + 0xfca97e7ee57ed79bL; + 0x4819242490243db4L; + 0x76fe3b3bec3bc5d7L; + 0x4b9aabab96ab313dL; + 0x81f0cece1fce3ed1L; + 0x2299111144118855L; + 0x03838f8f068f0c89L; + 0x9c044e4e254e4a6bL; + 0x7366b7b7e6b7d151L; + 0xcbe0ebeb8beb0b60L; + 0x78c13c3cf03cfdccL; + 0x1ffd81813e817cbfL; + 0x354094946a94d4feL; + 0xf31cf7f7fbf7eb0cL; + 0x6f18b9b9deb9a167L; + 0x268b13134c13985fL; + 0x58512c2cb02c7d9cL; + 0xbb05d3d36bd3d6b8L; + 0xd38ce7e7bbe76b5cL; + 0xdc396e6ea56e57cbL; + 0x95aac4c437c46ef3L; + 0x061b03030c03180fL; + 0xacdc565645568a13L; + 0x885e44440d441a49L; + 0xfea07f7fe17fdf9eL; + 0x4f88a9a99ea92137L; + 0x54672a2aa82a4d82L; + 0x6b0abbbbd6bbb16dL; + 0x9f87c1c123c146e2L; + 0xa6f153535153a202L; + 0xa572dcdc57dcae8bL; + 0x16530b0b2c0b5827L; + 0x27019d9d4e9d9cd3L; + 0xd82b6c6cad6c47c1L; + 0x62a43131c43195f5L; + 0xe8f37474cd7487b9L; + 0xf115f6f6fff6e309L; + 0x8c4c464605460a43L; + 0x45a5acac8aac0926L; + 0x0fb589891e893c97L; + 0x28b414145014a044L; + 0xdfbae1e1a3e15b42L; + 0x2ca616165816b04eL; + 0x74f73a3ae83acdd2L; + 0xd2066969b9696fd0L; + 0x124109092409482dL; + 0xe0d77070dd70a7adL; + 0x716fb6b6e2b6d954L; + 0xbd1ed0d067d0ceb7L; + 0xc7d6eded93ed3b7eL; + 0x85e2cccc17cc2edbL; + 0x8468424215422a57L; + 0x2d2c98985a98b4c2L; + 0x55eda4a4aaa4490eL; + 0x50752828a0285d88L; + 0xb8865c5c6d5cda31L; + 0xed6bf8f8c7f8933fL; + 0x11c28686228644a4L; + |]; + [| + 0x7830d818186018c0L; + 0xaf462623238c2305L; + 0xf991b8c6c63fc67eL; + 0x6fcdfbe8e887e813L; + 0xa113cb878726874cL; + 0x626d11b8b8dab8a9L; + 0x0502090101040108L; + 0x6e9e0d4f4f214f42L; + 0xee6c9b3636d836adL; + 0x0451ffa6a6a2a659L; + 0xbdb90cd2d26fd2deL; + 0x06f70ef5f5f3f5fbL; + 0x80f2967979f979efL; + 0xcede306f6fa16f5fL; + 0xef3f6d91917e91fcL; + 0x07a4f852525552aaL; + 0xfdc04760609d6027L; + 0x766535bcbccabc89L; + 0xcd2b379b9b569bacL; + 0x8c018a8e8e028e04L; + 0x155bd2a3a3b6a371L; + 0x3c186c0c0c300c60L; + 0x8af6847b7bf17bffL; + 0xe16a803535d435b5L; + 0x693af51d1d741de8L; + 0x47ddb3e0e0a7e053L; + 0xacb321d7d77bd7f6L; + 0xed999cc2c22fc25eL; + 0x965c432e2eb82e6dL; + 0x7a96294b4b314b62L; + 0x21e15dfefedffea3L; + 0x16aed55757415782L; + 0x412abd15155415a8L; + 0xb6eee87777c1779fL; + 0xeb6e923737dc37a5L; + 0x56d79ee5e5b3e57bL; + 0xd923139f9f469f8cL; + 0x17fd23f0f0e7f0d3L; + 0x7f94204a4a354a6aL; + 0x95a944dada4fda9eL; + 0x25b0a258587d58faL; + 0xca8fcfc9c903c906L; + 0x8d527c2929a42955L; + 0x22145a0a0a280a50L; + 0x4f7f50b1b1feb1e1L; + 0x1a5dc9a0a0baa069L; + 0xdad6146b6bb16b7fL; + 0xab17d985852e855cL; + 0x73673cbdbdcebd81L; + 0x34ba8f5d5d695dd2L; + 0x5020901010401080L; + 0x03f507f4f4f7f4f3L; + 0xc08bddcbcb0bcb16L; + 0xc67cd33e3ef83eedL; + 0x110a2d0505140528L; + 0xe6ce78676781671fL; + 0x53d597e4e4b7e473L; + 0xbb4e0227279c2725L; + 0x5882734141194132L; + 0x9d0ba78b8b168b2cL; + 0x0153f6a7a7a6a751L; + 0x94fab27d7de97dcfL; + 0xfb374995956e95dcL; + 0x9fad56d8d847d88eL; + 0x30eb70fbfbcbfb8bL; + 0x71c1cdeeee9fee23L; + 0x91f8bb7c7ced7cc7L; + 0xe3cc716666856617L; + 0x8ea77bdddd53dda6L; + 0x4b2eaf17175c17b8L; + 0x468e454747014702L; + 0xdc211a9e9e429e84L; + 0xc589d4caca0fca1eL; + 0x995a582d2db42d75L; + 0x79632ebfbfc6bf91L; + 0x1b0e3f07071c0738L; + 0x2347acadad8ead01L; + 0x2fb4b05a5a755aeaL; + 0xb51bef838336836cL; + 0xff66b63333cc3385L; + 0xf2c65c636391633fL; + 0x0a04120202080210L; + 0x384993aaaa92aa39L; + 0xa8e2de7171d971afL; + 0xcf8dc6c8c807c80eL; + 0x7d32d119196419c8L; + 0x70923b4949394972L; + 0x9aaf5fd9d943d986L; + 0x1df931f2f2eff2c3L; + 0x48dba8e3e3abe34bL; + 0x2ab6b95b5b715be2L; + 0x920dbc88881a8834L; + 0xc8293e9a9a529aa4L; + 0xbe4c0b262698262dL; + 0xfa64bf3232c8328dL; + 0x4a7d59b0b0fab0e9L; + 0x6acff2e9e983e91bL; + 0x331e770f0f3c0f78L; + 0xa6b733d5d573d5e6L; + 0xba1df480803a8074L; + 0x7c6127bebec2be99L; + 0xde87ebcdcd13cd26L; + 0xe468893434d034bdL; + 0x75903248483d487aL; + 0x24e354ffffdbffabL; + 0x8ff48d7a7af57af7L; + 0xea3d6490907a90f4L; + 0x3ebe9d5f5f615fc2L; + 0xa0403d202080201dL; + 0xd5d00f6868bd6867L; + 0x7234ca1a1a681ad0L; + 0x2c41b7aeae82ae19L; + 0x5e757db4b4eab4c9L; + 0x19a8ce54544d549aL; + 0xe53b7f93937693ecL; + 0xaa442f222288220dL; + 0xe9c86364648d6407L; + 0x12ff2af1f1e3f1dbL; + 0xa2e6cc7373d173bfL; + 0x5a24821212481290L; + 0x5d807a40401d403aL; + 0x2810480808200840L; + 0xe89b95c3c32bc356L; + 0x7bc5dfecec97ec33L; + 0x90ab4ddbdb4bdb96L; + 0x1f5fc0a1a1bea161L; + 0x8307918d8d0e8d1cL; + 0xc97ac83d3df43df5L; + 0xf1335b97976697ccL; + 0x0000000000000000L; + 0xd483f9cfcf1bcf36L; + 0x87566e2b2bac2b45L; + 0xb3ece17676c57697L; + 0xb019e68282328264L; + 0xa9b128d6d67fd6feL; + 0x7736c31b1b6c1bd8L; + 0x5b7774b5b5eeb5c1L; + 0x2943beafaf86af11L; + 0xdfd41d6a6ab56a77L; + 0x0da0ea50505d50baL; + 0x4c8a574545094512L; + 0x18fb38f3f3ebf3cbL; + 0xf060ad3030c0309dL; + 0x74c3c4efef9bef2bL; + 0xc37eda3f3ffc3fe5L; + 0x1caac75555495592L; + 0x1059dba2a2b2a279L; + 0x65c9e9eaea8fea03L; + 0xecca6a656589650fL; + 0x686903babad2bab9L; + 0x935e4a2f2fbc2f65L; + 0xe79d8ec0c027c04eL; + 0x81a160dede5fdebeL; + 0x6c38fc1c1c701ce0L; + 0x2ee746fdfdd3fdbbL; + 0x649a1f4d4d294d52L; + 0xe0397692927292e4L; + 0xbceafa7575c9758fL; + 0x1e0c360606180630L; + 0x9809ae8a8a128a24L; + 0x40794bb2b2f2b2f9L; + 0x59d185e6e6bfe663L; + 0x361c7e0e0e380e70L; + 0x633ee71f1f7c1ff8L; + 0xf7c4556262956237L; + 0xa3b53ad4d477d4eeL; + 0x324d81a8a89aa829L; + 0xf4315296966296c4L; + 0x3aef62f9f9c3f99bL; + 0xf697a3c5c533c566L; + 0xb14a102525942535L; + 0x20b2ab59597959f2L; + 0xae15d084842a8454L; + 0xa7e4c57272d572b7L; + 0xdd72ec3939e439d5L; + 0x6198164c4c2d4c5aL; + 0x3bbc945e5e655ecaL; + 0x85f09f7878fd78e7L; + 0xd870e53838e038ddL; + 0x8605988c8c0a8c14L; + 0xb2bf17d1d163d1c6L; + 0x0b57e4a5a5aea541L; + 0x4dd9a1e2e2afe243L; + 0xf8c24e616199612fL; + 0x457b42b3b3f6b3f1L; + 0xa542342121842115L; + 0xd625089c9c4a9c94L; + 0x663cee1e1e781ef0L; + 0x5286614343114322L; + 0xfc93b1c7c73bc776L; + 0x2be54ffcfcd7fcb3L; + 0x1408240404100420L; + 0x08a2e351515951b2L; + 0xc72f2599995e99bcL; + 0xc4da226d6da96d4fL; + 0x391a650d0d340d68L; + 0x35e979fafacffa83L; + 0x84a369dfdf5bdfb6L; + 0x9bfca97e7ee57ed7L; + 0xb44819242490243dL; + 0xd776fe3b3bec3bc5L; + 0x3d4b9aabab96ab31L; + 0xd181f0cece1fce3eL; + 0x5522991111441188L; + 0x8903838f8f068f0cL; + 0x6b9c044e4e254e4aL; + 0x517366b7b7e6b7d1L; + 0x60cbe0ebeb8beb0bL; + 0xcc78c13c3cf03cfdL; + 0xbf1ffd81813e817cL; + 0xfe354094946a94d4L; + 0x0cf31cf7f7fbf7ebL; + 0x676f18b9b9deb9a1L; + 0x5f268b13134c1398L; + 0x9c58512c2cb02c7dL; + 0xb8bb05d3d36bd3d6L; + 0x5cd38ce7e7bbe76bL; + 0xcbdc396e6ea56e57L; + 0xf395aac4c437c46eL; + 0x0f061b03030c0318L; + 0x13acdc565645568aL; + 0x49885e44440d441aL; + 0x9efea07f7fe17fdfL; + 0x374f88a9a99ea921L; + 0x8254672a2aa82a4dL; + 0x6d6b0abbbbd6bbb1L; + 0xe29f87c1c123c146L; + 0x02a6f153535153a2L; + 0x8ba572dcdc57dcaeL; + 0x2716530b0b2c0b58L; + 0xd327019d9d4e9d9cL; + 0xc1d82b6c6cad6c47L; + 0xf562a43131c43195L; + 0xb9e8f37474cd7487L; + 0x09f115f6f6fff6e3L; + 0x438c4c464605460aL; + 0x2645a5acac8aac09L; + 0x970fb589891e893cL; + 0x4428b414145014a0L; + 0x42dfbae1e1a3e15bL; + 0x4e2ca616165816b0L; + 0xd274f73a3ae83acdL; + 0xd0d2066969b9696fL; + 0x2d12410909240948L; + 0xade0d77070dd70a7L; + 0x54716fb6b6e2b6d9L; + 0xb7bd1ed0d067d0ceL; + 0x7ec7d6eded93ed3bL; + 0xdb85e2cccc17cc2eL; + 0x578468424215422aL; + 0xc22d2c98985a98b4L; + 0x0e55eda4a4aaa449L; + 0x8850752828a0285dL; + 0x31b8865c5c6d5cdaL; + 0x3fed6bf8f8c7f893L; + 0xa411c28686228644L; + |]; + [| + 0xc07830d818186018L; + 0x05af462623238c23L; + 0x7ef991b8c6c63fc6L; + 0x136fcdfbe8e887e8L; + 0x4ca113cb87872687L; + 0xa9626d11b8b8dab8L; + 0x0805020901010401L; + 0x426e9e0d4f4f214fL; + 0xadee6c9b3636d836L; + 0x590451ffa6a6a2a6L; + 0xdebdb90cd2d26fd2L; + 0xfb06f70ef5f5f3f5L; + 0xef80f2967979f979L; + 0x5fcede306f6fa16fL; + 0xfcef3f6d91917e91L; + 0xaa07a4f852525552L; + 0x27fdc04760609d60L; + 0x89766535bcbccabcL; + 0xaccd2b379b9b569bL; + 0x048c018a8e8e028eL; + 0x71155bd2a3a3b6a3L; + 0x603c186c0c0c300cL; + 0xff8af6847b7bf17bL; + 0xb5e16a803535d435L; + 0xe8693af51d1d741dL; + 0x5347ddb3e0e0a7e0L; + 0xf6acb321d7d77bd7L; + 0x5eed999cc2c22fc2L; + 0x6d965c432e2eb82eL; + 0x627a96294b4b314bL; + 0xa321e15dfefedffeL; + 0x8216aed557574157L; + 0xa8412abd15155415L; + 0x9fb6eee87777c177L; + 0xa5eb6e923737dc37L; + 0x7b56d79ee5e5b3e5L; + 0x8cd923139f9f469fL; + 0xd317fd23f0f0e7f0L; + 0x6a7f94204a4a354aL; + 0x9e95a944dada4fdaL; + 0xfa25b0a258587d58L; + 0x06ca8fcfc9c903c9L; + 0x558d527c2929a429L; + 0x5022145a0a0a280aL; + 0xe14f7f50b1b1feb1L; + 0x691a5dc9a0a0baa0L; + 0x7fdad6146b6bb16bL; + 0x5cab17d985852e85L; + 0x8173673cbdbdcebdL; + 0xd234ba8f5d5d695dL; + 0x8050209010104010L; + 0xf303f507f4f4f7f4L; + 0x16c08bddcbcb0bcbL; + 0xedc67cd33e3ef83eL; + 0x28110a2d05051405L; + 0x1fe6ce7867678167L; + 0x7353d597e4e4b7e4L; + 0x25bb4e0227279c27L; + 0x3258827341411941L; + 0x2c9d0ba78b8b168bL; + 0x510153f6a7a7a6a7L; + 0xcf94fab27d7de97dL; + 0xdcfb374995956e95L; + 0x8e9fad56d8d847d8L; + 0x8b30eb70fbfbcbfbL; + 0x2371c1cdeeee9feeL; + 0xc791f8bb7c7ced7cL; + 0x17e3cc7166668566L; + 0xa68ea77bdddd53ddL; + 0xb84b2eaf17175c17L; + 0x02468e4547470147L; + 0x84dc211a9e9e429eL; + 0x1ec589d4caca0fcaL; + 0x75995a582d2db42dL; + 0x9179632ebfbfc6bfL; + 0x381b0e3f07071c07L; + 0x012347acadad8eadL; + 0xea2fb4b05a5a755aL; + 0x6cb51bef83833683L; + 0x85ff66b63333cc33L; + 0x3ff2c65c63639163L; + 0x100a041202020802L; + 0x39384993aaaa92aaL; + 0xafa8e2de7171d971L; + 0x0ecf8dc6c8c807c8L; + 0xc87d32d119196419L; + 0x7270923b49493949L; + 0x869aaf5fd9d943d9L; + 0xc31df931f2f2eff2L; + 0x4b48dba8e3e3abe3L; + 0xe22ab6b95b5b715bL; + 0x34920dbc88881a88L; + 0xa4c8293e9a9a529aL; + 0x2dbe4c0b26269826L; + 0x8dfa64bf3232c832L; + 0xe94a7d59b0b0fab0L; + 0x1b6acff2e9e983e9L; + 0x78331e770f0f3c0fL; + 0xe6a6b733d5d573d5L; + 0x74ba1df480803a80L; + 0x997c6127bebec2beL; + 0x26de87ebcdcd13cdL; + 0xbde468893434d034L; + 0x7a75903248483d48L; + 0xab24e354ffffdbffL; + 0xf78ff48d7a7af57aL; + 0xf4ea3d6490907a90L; + 0xc23ebe9d5f5f615fL; + 0x1da0403d20208020L; + 0x67d5d00f6868bd68L; + 0xd07234ca1a1a681aL; + 0x192c41b7aeae82aeL; + 0xc95e757db4b4eab4L; + 0x9a19a8ce54544d54L; + 0xece53b7f93937693L; + 0x0daa442f22228822L; + 0x07e9c86364648d64L; + 0xdb12ff2af1f1e3f1L; + 0xbfa2e6cc7373d173L; + 0x905a248212124812L; + 0x3a5d807a40401d40L; + 0x4028104808082008L; + 0x56e89b95c3c32bc3L; + 0x337bc5dfecec97ecL; + 0x9690ab4ddbdb4bdbL; + 0x611f5fc0a1a1bea1L; + 0x1c8307918d8d0e8dL; + 0xf5c97ac83d3df43dL; + 0xccf1335b97976697L; + 0x0000000000000000L; + 0x36d483f9cfcf1bcfL; + 0x4587566e2b2bac2bL; + 0x97b3ece17676c576L; + 0x64b019e682823282L; + 0xfea9b128d6d67fd6L; + 0xd87736c31b1b6c1bL; + 0xc15b7774b5b5eeb5L; + 0x112943beafaf86afL; + 0x77dfd41d6a6ab56aL; + 0xba0da0ea50505d50L; + 0x124c8a5745450945L; + 0xcb18fb38f3f3ebf3L; + 0x9df060ad3030c030L; + 0x2b74c3c4efef9befL; + 0xe5c37eda3f3ffc3fL; + 0x921caac755554955L; + 0x791059dba2a2b2a2L; + 0x0365c9e9eaea8feaL; + 0x0fecca6a65658965L; + 0xb9686903babad2baL; + 0x65935e4a2f2fbc2fL; + 0x4ee79d8ec0c027c0L; + 0xbe81a160dede5fdeL; + 0xe06c38fc1c1c701cL; + 0xbb2ee746fdfdd3fdL; + 0x52649a1f4d4d294dL; + 0xe4e0397692927292L; + 0x8fbceafa7575c975L; + 0x301e0c3606061806L; + 0x249809ae8a8a128aL; + 0xf940794bb2b2f2b2L; + 0x6359d185e6e6bfe6L; + 0x70361c7e0e0e380eL; + 0xf8633ee71f1f7c1fL; + 0x37f7c45562629562L; + 0xeea3b53ad4d477d4L; + 0x29324d81a8a89aa8L; + 0xc4f4315296966296L; + 0x9b3aef62f9f9c3f9L; + 0x66f697a3c5c533c5L; + 0x35b14a1025259425L; + 0xf220b2ab59597959L; + 0x54ae15d084842a84L; + 0xb7a7e4c57272d572L; + 0xd5dd72ec3939e439L; + 0x5a6198164c4c2d4cL; + 0xca3bbc945e5e655eL; + 0xe785f09f7878fd78L; + 0xddd870e53838e038L; + 0x148605988c8c0a8cL; + 0xc6b2bf17d1d163d1L; + 0x410b57e4a5a5aea5L; + 0x434dd9a1e2e2afe2L; + 0x2ff8c24e61619961L; + 0xf1457b42b3b3f6b3L; + 0x15a5423421218421L; + 0x94d625089c9c4a9cL; + 0xf0663cee1e1e781eL; + 0x2252866143431143L; + 0x76fc93b1c7c73bc7L; + 0xb32be54ffcfcd7fcL; + 0x2014082404041004L; + 0xb208a2e351515951L; + 0xbcc72f2599995e99L; + 0x4fc4da226d6da96dL; + 0x68391a650d0d340dL; + 0x8335e979fafacffaL; + 0xb684a369dfdf5bdfL; + 0xd79bfca97e7ee57eL; + 0x3db4481924249024L; + 0xc5d776fe3b3bec3bL; + 0x313d4b9aabab96abL; + 0x3ed181f0cece1fceL; + 0x8855229911114411L; + 0x0c8903838f8f068fL; + 0x4a6b9c044e4e254eL; + 0xd1517366b7b7e6b7L; + 0x0b60cbe0ebeb8bebL; + 0xfdcc78c13c3cf03cL; + 0x7cbf1ffd81813e81L; + 0xd4fe354094946a94L; + 0xeb0cf31cf7f7fbf7L; + 0xa1676f18b9b9deb9L; + 0x985f268b13134c13L; + 0x7d9c58512c2cb02cL; + 0xd6b8bb05d3d36bd3L; + 0x6b5cd38ce7e7bbe7L; + 0x57cbdc396e6ea56eL; + 0x6ef395aac4c437c4L; + 0x180f061b03030c03L; + 0x8a13acdc56564556L; + 0x1a49885e44440d44L; + 0xdf9efea07f7fe17fL; + 0x21374f88a9a99ea9L; + 0x4d8254672a2aa82aL; + 0xb16d6b0abbbbd6bbL; + 0x46e29f87c1c123c1L; + 0xa202a6f153535153L; + 0xae8ba572dcdc57dcL; + 0x582716530b0b2c0bL; + 0x9cd327019d9d4e9dL; + 0x47c1d82b6c6cad6cL; + 0x95f562a43131c431L; + 0x87b9e8f37474cd74L; + 0xe309f115f6f6fff6L; + 0x0a438c4c46460546L; + 0x092645a5acac8aacL; + 0x3c970fb589891e89L; + 0xa04428b414145014L; + 0x5b42dfbae1e1a3e1L; + 0xb04e2ca616165816L; + 0xcdd274f73a3ae83aL; + 0x6fd0d2066969b969L; + 0x482d124109092409L; + 0xa7ade0d77070dd70L; + 0xd954716fb6b6e2b6L; + 0xceb7bd1ed0d067d0L; + 0x3b7ec7d6eded93edL; + 0x2edb85e2cccc17ccL; + 0x2a57846842421542L; + 0xb4c22d2c98985a98L; + 0x490e55eda4a4aaa4L; + 0x5d8850752828a028L; + 0xda31b8865c5c6d5cL; + 0x933fed6bf8f8c7f8L; + 0x44a411c286862286L; + |]; + [| + 0x18c07830d8181860L; + 0x2305af462623238cL; + 0xc67ef991b8c6c63fL; + 0xe8136fcdfbe8e887L; + 0x874ca113cb878726L; + 0xb8a9626d11b8b8daL; + 0x0108050209010104L; + 0x4f426e9e0d4f4f21L; + 0x36adee6c9b3636d8L; + 0xa6590451ffa6a6a2L; + 0xd2debdb90cd2d26fL; + 0xf5fb06f70ef5f5f3L; + 0x79ef80f2967979f9L; + 0x6f5fcede306f6fa1L; + 0x91fcef3f6d91917eL; + 0x52aa07a4f8525255L; + 0x6027fdc04760609dL; + 0xbc89766535bcbccaL; + 0x9baccd2b379b9b56L; + 0x8e048c018a8e8e02L; + 0xa371155bd2a3a3b6L; + 0x0c603c186c0c0c30L; + 0x7bff8af6847b7bf1L; + 0x35b5e16a803535d4L; + 0x1de8693af51d1d74L; + 0xe05347ddb3e0e0a7L; + 0xd7f6acb321d7d77bL; + 0xc25eed999cc2c22fL; + 0x2e6d965c432e2eb8L; + 0x4b627a96294b4b31L; + 0xfea321e15dfefedfL; + 0x578216aed5575741L; + 0x15a8412abd151554L; + 0x779fb6eee87777c1L; + 0x37a5eb6e923737dcL; + 0xe57b56d79ee5e5b3L; + 0x9f8cd923139f9f46L; + 0xf0d317fd23f0f0e7L; + 0x4a6a7f94204a4a35L; + 0xda9e95a944dada4fL; + 0x58fa25b0a258587dL; + 0xc906ca8fcfc9c903L; + 0x29558d527c2929a4L; + 0x0a5022145a0a0a28L; + 0xb1e14f7f50b1b1feL; + 0xa0691a5dc9a0a0baL; + 0x6b7fdad6146b6bb1L; + 0x855cab17d985852eL; + 0xbd8173673cbdbdceL; + 0x5dd234ba8f5d5d69L; + 0x1080502090101040L; + 0xf4f303f507f4f4f7L; + 0xcb16c08bddcbcb0bL; + 0x3eedc67cd33e3ef8L; + 0x0528110a2d050514L; + 0x671fe6ce78676781L; + 0xe47353d597e4e4b7L; + 0x2725bb4e0227279cL; + 0x4132588273414119L; + 0x8b2c9d0ba78b8b16L; + 0xa7510153f6a7a7a6L; + 0x7dcf94fab27d7de9L; + 0x95dcfb374995956eL; + 0xd88e9fad56d8d847L; + 0xfb8b30eb70fbfbcbL; + 0xee2371c1cdeeee9fL; + 0x7cc791f8bb7c7cedL; + 0x6617e3cc71666685L; + 0xdda68ea77bdddd53L; + 0x17b84b2eaf17175cL; + 0x4702468e45474701L; + 0x9e84dc211a9e9e42L; + 0xca1ec589d4caca0fL; + 0x2d75995a582d2db4L; + 0xbf9179632ebfbfc6L; + 0x07381b0e3f07071cL; + 0xad012347acadad8eL; + 0x5aea2fb4b05a5a75L; + 0x836cb51bef838336L; + 0x3385ff66b63333ccL; + 0x633ff2c65c636391L; + 0x02100a0412020208L; + 0xaa39384993aaaa92L; + 0x71afa8e2de7171d9L; + 0xc80ecf8dc6c8c807L; + 0x19c87d32d1191964L; + 0x497270923b494939L; + 0xd9869aaf5fd9d943L; + 0xf2c31df931f2f2efL; + 0xe34b48dba8e3e3abL; + 0x5be22ab6b95b5b71L; + 0x8834920dbc88881aL; + 0x9aa4c8293e9a9a52L; + 0x262dbe4c0b262698L; + 0x328dfa64bf3232c8L; + 0xb0e94a7d59b0b0faL; + 0xe91b6acff2e9e983L; + 0x0f78331e770f0f3cL; + 0xd5e6a6b733d5d573L; + 0x8074ba1df480803aL; + 0xbe997c6127bebec2L; + 0xcd26de87ebcdcd13L; + 0x34bde468893434d0L; + 0x487a75903248483dL; + 0xffab24e354ffffdbL; + 0x7af78ff48d7a7af5L; + 0x90f4ea3d6490907aL; + 0x5fc23ebe9d5f5f61L; + 0x201da0403d202080L; + 0x6867d5d00f6868bdL; + 0x1ad07234ca1a1a68L; + 0xae192c41b7aeae82L; + 0xb4c95e757db4b4eaL; + 0x549a19a8ce54544dL; + 0x93ece53b7f939376L; + 0x220daa442f222288L; + 0x6407e9c86364648dL; + 0xf1db12ff2af1f1e3L; + 0x73bfa2e6cc7373d1L; + 0x12905a2482121248L; + 0x403a5d807a40401dL; + 0x0840281048080820L; + 0xc356e89b95c3c32bL; + 0xec337bc5dfecec97L; + 0xdb9690ab4ddbdb4bL; + 0xa1611f5fc0a1a1beL; + 0x8d1c8307918d8d0eL; + 0x3df5c97ac83d3df4L; + 0x97ccf1335b979766L; + 0x0000000000000000L; + 0xcf36d483f9cfcf1bL; + 0x2b4587566e2b2bacL; + 0x7697b3ece17676c5L; + 0x8264b019e6828232L; + 0xd6fea9b128d6d67fL; + 0x1bd87736c31b1b6cL; + 0xb5c15b7774b5b5eeL; + 0xaf112943beafaf86L; + 0x6a77dfd41d6a6ab5L; + 0x50ba0da0ea50505dL; + 0x45124c8a57454509L; + 0xf3cb18fb38f3f3ebL; + 0x309df060ad3030c0L; + 0xef2b74c3c4efef9bL; + 0x3fe5c37eda3f3ffcL; + 0x55921caac7555549L; + 0xa2791059dba2a2b2L; + 0xea0365c9e9eaea8fL; + 0x650fecca6a656589L; + 0xbab9686903babad2L; + 0x2f65935e4a2f2fbcL; + 0xc04ee79d8ec0c027L; + 0xdebe81a160dede5fL; + 0x1ce06c38fc1c1c70L; + 0xfdbb2ee746fdfdd3L; + 0x4d52649a1f4d4d29L; + 0x92e4e03976929272L; + 0x758fbceafa7575c9L; + 0x06301e0c36060618L; + 0x8a249809ae8a8a12L; + 0xb2f940794bb2b2f2L; + 0xe66359d185e6e6bfL; + 0x0e70361c7e0e0e38L; + 0x1ff8633ee71f1f7cL; + 0x6237f7c455626295L; + 0xd4eea3b53ad4d477L; + 0xa829324d81a8a89aL; + 0x96c4f43152969662L; + 0xf99b3aef62f9f9c3L; + 0xc566f697a3c5c533L; + 0x2535b14a10252594L; + 0x59f220b2ab595979L; + 0x8454ae15d084842aL; + 0x72b7a7e4c57272d5L; + 0x39d5dd72ec3939e4L; + 0x4c5a6198164c4c2dL; + 0x5eca3bbc945e5e65L; + 0x78e785f09f7878fdL; + 0x38ddd870e53838e0L; + 0x8c148605988c8c0aL; + 0xd1c6b2bf17d1d163L; + 0xa5410b57e4a5a5aeL; + 0xe2434dd9a1e2e2afL; + 0x612ff8c24e616199L; + 0xb3f1457b42b3b3f6L; + 0x2115a54234212184L; + 0x9c94d625089c9c4aL; + 0x1ef0663cee1e1e78L; + 0x4322528661434311L; + 0xc776fc93b1c7c73bL; + 0xfcb32be54ffcfcd7L; + 0x0420140824040410L; + 0x51b208a2e3515159L; + 0x99bcc72f2599995eL; + 0x6d4fc4da226d6da9L; + 0x0d68391a650d0d34L; + 0xfa8335e979fafacfL; + 0xdfb684a369dfdf5bL; + 0x7ed79bfca97e7ee5L; + 0x243db44819242490L; + 0x3bc5d776fe3b3becL; + 0xab313d4b9aabab96L; + 0xce3ed181f0cece1fL; + 0x1188552299111144L; + 0x8f0c8903838f8f06L; + 0x4e4a6b9c044e4e25L; + 0xb7d1517366b7b7e6L; + 0xeb0b60cbe0ebeb8bL; + 0x3cfdcc78c13c3cf0L; + 0x817cbf1ffd81813eL; + 0x94d4fe354094946aL; + 0xf7eb0cf31cf7f7fbL; + 0xb9a1676f18b9b9deL; + 0x13985f268b13134cL; + 0x2c7d9c58512c2cb0L; + 0xd3d6b8bb05d3d36bL; + 0xe76b5cd38ce7e7bbL; + 0x6e57cbdc396e6ea5L; + 0xc46ef395aac4c437L; + 0x03180f061b03030cL; + 0x568a13acdc565645L; + 0x441a49885e44440dL; + 0x7fdf9efea07f7fe1L; + 0xa921374f88a9a99eL; + 0x2a4d8254672a2aa8L; + 0xbbb16d6b0abbbbd6L; + 0xc146e29f87c1c123L; + 0x53a202a6f1535351L; + 0xdcae8ba572dcdc57L; + 0x0b582716530b0b2cL; + 0x9d9cd327019d9d4eL; + 0x6c47c1d82b6c6cadL; + 0x3195f562a43131c4L; + 0x7487b9e8f37474cdL; + 0xf6e309f115f6f6ffL; + 0x460a438c4c464605L; + 0xac092645a5acac8aL; + 0x893c970fb589891eL; + 0x14a04428b4141450L; + 0xe15b42dfbae1e1a3L; + 0x16b04e2ca6161658L; + 0x3acdd274f73a3ae8L; + 0x696fd0d2066969b9L; + 0x09482d1241090924L; + 0x70a7ade0d77070ddL; + 0xb6d954716fb6b6e2L; + 0xd0ceb7bd1ed0d067L; + 0xed3b7ec7d6eded93L; + 0xcc2edb85e2cccc17L; + 0x422a578468424215L; + 0x98b4c22d2c98985aL; + 0xa4490e55eda4a4aaL; + 0x285d8850752828a0L; + 0x5cda31b8865c5c6dL; + 0xf8933fed6bf8f8c7L; + 0x8644a411c2868622L; + |]; + [| + 0x6018c07830d81818L; + 0x8c2305af46262323L; + 0x3fc67ef991b8c6c6L; + 0x87e8136fcdfbe8e8L; + 0x26874ca113cb8787L; + 0xdab8a9626d11b8b8L; + 0x0401080502090101L; + 0x214f426e9e0d4f4fL; + 0xd836adee6c9b3636L; + 0xa2a6590451ffa6a6L; + 0x6fd2debdb90cd2d2L; + 0xf3f5fb06f70ef5f5L; + 0xf979ef80f2967979L; + 0xa16f5fcede306f6fL; + 0x7e91fcef3f6d9191L; + 0x5552aa07a4f85252L; + 0x9d6027fdc0476060L; + 0xcabc89766535bcbcL; + 0x569baccd2b379b9bL; + 0x028e048c018a8e8eL; + 0xb6a371155bd2a3a3L; + 0x300c603c186c0c0cL; + 0xf17bff8af6847b7bL; + 0xd435b5e16a803535L; + 0x741de8693af51d1dL; + 0xa7e05347ddb3e0e0L; + 0x7bd7f6acb321d7d7L; + 0x2fc25eed999cc2c2L; + 0xb82e6d965c432e2eL; + 0x314b627a96294b4bL; + 0xdffea321e15dfefeL; + 0x41578216aed55757L; + 0x5415a8412abd1515L; + 0xc1779fb6eee87777L; + 0xdc37a5eb6e923737L; + 0xb3e57b56d79ee5e5L; + 0x469f8cd923139f9fL; + 0xe7f0d317fd23f0f0L; + 0x354a6a7f94204a4aL; + 0x4fda9e95a944dadaL; + 0x7d58fa25b0a25858L; + 0x03c906ca8fcfc9c9L; + 0xa429558d527c2929L; + 0x280a5022145a0a0aL; + 0xfeb1e14f7f50b1b1L; + 0xbaa0691a5dc9a0a0L; + 0xb16b7fdad6146b6bL; + 0x2e855cab17d98585L; + 0xcebd8173673cbdbdL; + 0x695dd234ba8f5d5dL; + 0x4010805020901010L; + 0xf7f4f303f507f4f4L; + 0x0bcb16c08bddcbcbL; + 0xf83eedc67cd33e3eL; + 0x140528110a2d0505L; + 0x81671fe6ce786767L; + 0xb7e47353d597e4e4L; + 0x9c2725bb4e022727L; + 0x1941325882734141L; + 0x168b2c9d0ba78b8bL; + 0xa6a7510153f6a7a7L; + 0xe97dcf94fab27d7dL; + 0x6e95dcfb37499595L; + 0x47d88e9fad56d8d8L; + 0xcbfb8b30eb70fbfbL; + 0x9fee2371c1cdeeeeL; + 0xed7cc791f8bb7c7cL; + 0x856617e3cc716666L; + 0x53dda68ea77bddddL; + 0x5c17b84b2eaf1717L; + 0x014702468e454747L; + 0x429e84dc211a9e9eL; + 0x0fca1ec589d4cacaL; + 0xb42d75995a582d2dL; + 0xc6bf9179632ebfbfL; + 0x1c07381b0e3f0707L; + 0x8ead012347acadadL; + 0x755aea2fb4b05a5aL; + 0x36836cb51bef8383L; + 0xcc3385ff66b63333L; + 0x91633ff2c65c6363L; + 0x0802100a04120202L; + 0x92aa39384993aaaaL; + 0xd971afa8e2de7171L; + 0x07c80ecf8dc6c8c8L; + 0x6419c87d32d11919L; + 0x39497270923b4949L; + 0x43d9869aaf5fd9d9L; + 0xeff2c31df931f2f2L; + 0xabe34b48dba8e3e3L; + 0x715be22ab6b95b5bL; + 0x1a8834920dbc8888L; + 0x529aa4c8293e9a9aL; + 0x98262dbe4c0b2626L; + 0xc8328dfa64bf3232L; + 0xfab0e94a7d59b0b0L; + 0x83e91b6acff2e9e9L; + 0x3c0f78331e770f0fL; + 0x73d5e6a6b733d5d5L; + 0x3a8074ba1df48080L; + 0xc2be997c6127bebeL; + 0x13cd26de87ebcdcdL; + 0xd034bde468893434L; + 0x3d487a7590324848L; + 0xdbffab24e354ffffL; + 0xf57af78ff48d7a7aL; + 0x7a90f4ea3d649090L; + 0x615fc23ebe9d5f5fL; + 0x80201da0403d2020L; + 0xbd6867d5d00f6868L; + 0x681ad07234ca1a1aL; + 0x82ae192c41b7aeaeL; + 0xeab4c95e757db4b4L; + 0x4d549a19a8ce5454L; + 0x7693ece53b7f9393L; + 0x88220daa442f2222L; + 0x8d6407e9c8636464L; + 0xe3f1db12ff2af1f1L; + 0xd173bfa2e6cc7373L; + 0x4812905a24821212L; + 0x1d403a5d807a4040L; + 0x2008402810480808L; + 0x2bc356e89b95c3c3L; + 0x97ec337bc5dfececL; + 0x4bdb9690ab4ddbdbL; + 0xbea1611f5fc0a1a1L; + 0x0e8d1c8307918d8dL; + 0xf43df5c97ac83d3dL; + 0x6697ccf1335b9797L; + 0x0000000000000000L; + 0x1bcf36d483f9cfcfL; + 0xac2b4587566e2b2bL; + 0xc57697b3ece17676L; + 0x328264b019e68282L; + 0x7fd6fea9b128d6d6L; + 0x6c1bd87736c31b1bL; + 0xeeb5c15b7774b5b5L; + 0x86af112943beafafL; + 0xb56a77dfd41d6a6aL; + 0x5d50ba0da0ea5050L; + 0x0945124c8a574545L; + 0xebf3cb18fb38f3f3L; + 0xc0309df060ad3030L; + 0x9bef2b74c3c4efefL; + 0xfc3fe5c37eda3f3fL; + 0x4955921caac75555L; + 0xb2a2791059dba2a2L; + 0x8fea0365c9e9eaeaL; + 0x89650fecca6a6565L; + 0xd2bab9686903babaL; + 0xbc2f65935e4a2f2fL; + 0x27c04ee79d8ec0c0L; + 0x5fdebe81a160dedeL; + 0x701ce06c38fc1c1cL; + 0xd3fdbb2ee746fdfdL; + 0x294d52649a1f4d4dL; + 0x7292e4e039769292L; + 0xc9758fbceafa7575L; + 0x1806301e0c360606L; + 0x128a249809ae8a8aL; + 0xf2b2f940794bb2b2L; + 0xbfe66359d185e6e6L; + 0x380e70361c7e0e0eL; + 0x7c1ff8633ee71f1fL; + 0x956237f7c4556262L; + 0x77d4eea3b53ad4d4L; + 0x9aa829324d81a8a8L; + 0x6296c4f431529696L; + 0xc3f99b3aef62f9f9L; + 0x33c566f697a3c5c5L; + 0x942535b14a102525L; + 0x7959f220b2ab5959L; + 0x2a8454ae15d08484L; + 0xd572b7a7e4c57272L; + 0xe439d5dd72ec3939L; + 0x2d4c5a6198164c4cL; + 0x655eca3bbc945e5eL; + 0xfd78e785f09f7878L; + 0xe038ddd870e53838L; + 0x0a8c148605988c8cL; + 0x63d1c6b2bf17d1d1L; + 0xaea5410b57e4a5a5L; + 0xafe2434dd9a1e2e2L; + 0x99612ff8c24e6161L; + 0xf6b3f1457b42b3b3L; + 0x842115a542342121L; + 0x4a9c94d625089c9cL; + 0x781ef0663cee1e1eL; + 0x1143225286614343L; + 0x3bc776fc93b1c7c7L; + 0xd7fcb32be54ffcfcL; + 0x1004201408240404L; + 0x5951b208a2e35151L; + 0x5e99bcc72f259999L; + 0xa96d4fc4da226d6dL; + 0x340d68391a650d0dL; + 0xcffa8335e979fafaL; + 0x5bdfb684a369dfdfL; + 0xe57ed79bfca97e7eL; + 0x90243db448192424L; + 0xec3bc5d776fe3b3bL; + 0x96ab313d4b9aababL; + 0x1fce3ed181f0ceceL; + 0x4411885522991111L; + 0x068f0c8903838f8fL; + 0x254e4a6b9c044e4eL; + 0xe6b7d1517366b7b7L; + 0x8beb0b60cbe0ebebL; + 0xf03cfdcc78c13c3cL; + 0x3e817cbf1ffd8181L; + 0x6a94d4fe35409494L; + 0xfbf7eb0cf31cf7f7L; + 0xdeb9a1676f18b9b9L; + 0x4c13985f268b1313L; + 0xb02c7d9c58512c2cL; + 0x6bd3d6b8bb05d3d3L; + 0xbbe76b5cd38ce7e7L; + 0xa56e57cbdc396e6eL; + 0x37c46ef395aac4c4L; + 0x0c03180f061b0303L; + 0x45568a13acdc5656L; + 0x0d441a49885e4444L; + 0xe17fdf9efea07f7fL; + 0x9ea921374f88a9a9L; + 0xa82a4d8254672a2aL; + 0xd6bbb16d6b0abbbbL; + 0x23c146e29f87c1c1L; + 0x5153a202a6f15353L; + 0x57dcae8ba572dcdcL; + 0x2c0b582716530b0bL; + 0x4e9d9cd327019d9dL; + 0xad6c47c1d82b6c6cL; + 0xc43195f562a43131L; + 0xcd7487b9e8f37474L; + 0xfff6e309f115f6f6L; + 0x05460a438c4c4646L; + 0x8aac092645a5acacL; + 0x1e893c970fb58989L; + 0x5014a04428b41414L; + 0xa3e15b42dfbae1e1L; + 0x5816b04e2ca61616L; + 0xe83acdd274f73a3aL; + 0xb9696fd0d2066969L; + 0x2409482d12410909L; + 0xdd70a7ade0d77070L; + 0xe2b6d954716fb6b6L; + 0x67d0ceb7bd1ed0d0L; + 0x93ed3b7ec7d6ededL; + 0x17cc2edb85e2ccccL; + 0x15422a5784684242L; + 0x5a98b4c22d2c9898L; + 0xaaa4490e55eda4a4L; + 0xa0285d8850752828L; + 0x6d5cda31b8865c5cL; + 0xc7f8933fed6bf8f8L; + 0x228644a411c28686L; + |]; + [| + 0x186018c07830d818L; + 0x238c2305af462623L; + 0xc63fc67ef991b8c6L; + 0xe887e8136fcdfbe8L; + 0x8726874ca113cb87L; + 0xb8dab8a9626d11b8L; + 0x0104010805020901L; + 0x4f214f426e9e0d4fL; + 0x36d836adee6c9b36L; + 0xa6a2a6590451ffa6L; + 0xd26fd2debdb90cd2L; + 0xf5f3f5fb06f70ef5L; + 0x79f979ef80f29679L; + 0x6fa16f5fcede306fL; + 0x917e91fcef3f6d91L; + 0x525552aa07a4f852L; + 0x609d6027fdc04760L; + 0xbccabc89766535bcL; + 0x9b569baccd2b379bL; + 0x8e028e048c018a8eL; + 0xa3b6a371155bd2a3L; + 0x0c300c603c186c0cL; + 0x7bf17bff8af6847bL; + 0x35d435b5e16a8035L; + 0x1d741de8693af51dL; + 0xe0a7e05347ddb3e0L; + 0xd77bd7f6acb321d7L; + 0xc22fc25eed999cc2L; + 0x2eb82e6d965c432eL; + 0x4b314b627a96294bL; + 0xfedffea321e15dfeL; + 0x5741578216aed557L; + 0x155415a8412abd15L; + 0x77c1779fb6eee877L; + 0x37dc37a5eb6e9237L; + 0xe5b3e57b56d79ee5L; + 0x9f469f8cd923139fL; + 0xf0e7f0d317fd23f0L; + 0x4a354a6a7f94204aL; + 0xda4fda9e95a944daL; + 0x587d58fa25b0a258L; + 0xc903c906ca8fcfc9L; + 0x29a429558d527c29L; + 0x0a280a5022145a0aL; + 0xb1feb1e14f7f50b1L; + 0xa0baa0691a5dc9a0L; + 0x6bb16b7fdad6146bL; + 0x852e855cab17d985L; + 0xbdcebd8173673cbdL; + 0x5d695dd234ba8f5dL; + 0x1040108050209010L; + 0xf4f7f4f303f507f4L; + 0xcb0bcb16c08bddcbL; + 0x3ef83eedc67cd33eL; + 0x05140528110a2d05L; + 0x6781671fe6ce7867L; + 0xe4b7e47353d597e4L; + 0x279c2725bb4e0227L; + 0x4119413258827341L; + 0x8b168b2c9d0ba78bL; + 0xa7a6a7510153f6a7L; + 0x7de97dcf94fab27dL; + 0x956e95dcfb374995L; + 0xd847d88e9fad56d8L; + 0xfbcbfb8b30eb70fbL; + 0xee9fee2371c1cdeeL; + 0x7ced7cc791f8bb7cL; + 0x66856617e3cc7166L; + 0xdd53dda68ea77bddL; + 0x175c17b84b2eaf17L; + 0x47014702468e4547L; + 0x9e429e84dc211a9eL; + 0xca0fca1ec589d4caL; + 0x2db42d75995a582dL; + 0xbfc6bf9179632ebfL; + 0x071c07381b0e3f07L; + 0xad8ead012347acadL; + 0x5a755aea2fb4b05aL; + 0x8336836cb51bef83L; + 0x33cc3385ff66b633L; + 0x6391633ff2c65c63L; + 0x020802100a041202L; + 0xaa92aa39384993aaL; + 0x71d971afa8e2de71L; + 0xc807c80ecf8dc6c8L; + 0x196419c87d32d119L; + 0x4939497270923b49L; + 0xd943d9869aaf5fd9L; + 0xf2eff2c31df931f2L; + 0xe3abe34b48dba8e3L; + 0x5b715be22ab6b95bL; + 0x881a8834920dbc88L; + 0x9a529aa4c8293e9aL; + 0x2698262dbe4c0b26L; + 0x32c8328dfa64bf32L; + 0xb0fab0e94a7d59b0L; + 0xe983e91b6acff2e9L; + 0x0f3c0f78331e770fL; + 0xd573d5e6a6b733d5L; + 0x803a8074ba1df480L; + 0xbec2be997c6127beL; + 0xcd13cd26de87ebcdL; + 0x34d034bde4688934L; + 0x483d487a75903248L; + 0xffdbffab24e354ffL; + 0x7af57af78ff48d7aL; + 0x907a90f4ea3d6490L; + 0x5f615fc23ebe9d5fL; + 0x2080201da0403d20L; + 0x68bd6867d5d00f68L; + 0x1a681ad07234ca1aL; + 0xae82ae192c41b7aeL; + 0xb4eab4c95e757db4L; + 0x544d549a19a8ce54L; + 0x937693ece53b7f93L; + 0x2288220daa442f22L; + 0x648d6407e9c86364L; + 0xf1e3f1db12ff2af1L; + 0x73d173bfa2e6cc73L; + 0x124812905a248212L; + 0x401d403a5d807a40L; + 0x0820084028104808L; + 0xc32bc356e89b95c3L; + 0xec97ec337bc5dfecL; + 0xdb4bdb9690ab4ddbL; + 0xa1bea1611f5fc0a1L; + 0x8d0e8d1c8307918dL; + 0x3df43df5c97ac83dL; + 0x976697ccf1335b97L; + 0x0000000000000000L; + 0xcf1bcf36d483f9cfL; + 0x2bac2b4587566e2bL; + 0x76c57697b3ece176L; + 0x82328264b019e682L; + 0xd67fd6fea9b128d6L; + 0x1b6c1bd87736c31bL; + 0xb5eeb5c15b7774b5L; + 0xaf86af112943beafL; + 0x6ab56a77dfd41d6aL; + 0x505d50ba0da0ea50L; + 0x450945124c8a5745L; + 0xf3ebf3cb18fb38f3L; + 0x30c0309df060ad30L; + 0xef9bef2b74c3c4efL; + 0x3ffc3fe5c37eda3fL; + 0x554955921caac755L; + 0xa2b2a2791059dba2L; + 0xea8fea0365c9e9eaL; + 0x6589650fecca6a65L; + 0xbad2bab9686903baL; + 0x2fbc2f65935e4a2fL; + 0xc027c04ee79d8ec0L; + 0xde5fdebe81a160deL; + 0x1c701ce06c38fc1cL; + 0xfdd3fdbb2ee746fdL; + 0x4d294d52649a1f4dL; + 0x927292e4e0397692L; + 0x75c9758fbceafa75L; + 0x061806301e0c3606L; + 0x8a128a249809ae8aL; + 0xb2f2b2f940794bb2L; + 0xe6bfe66359d185e6L; + 0x0e380e70361c7e0eL; + 0x1f7c1ff8633ee71fL; + 0x62956237f7c45562L; + 0xd477d4eea3b53ad4L; + 0xa89aa829324d81a8L; + 0x966296c4f4315296L; + 0xf9c3f99b3aef62f9L; + 0xc533c566f697a3c5L; + 0x25942535b14a1025L; + 0x597959f220b2ab59L; + 0x842a8454ae15d084L; + 0x72d572b7a7e4c572L; + 0x39e439d5dd72ec39L; + 0x4c2d4c5a6198164cL; + 0x5e655eca3bbc945eL; + 0x78fd78e785f09f78L; + 0x38e038ddd870e538L; + 0x8c0a8c148605988cL; + 0xd163d1c6b2bf17d1L; + 0xa5aea5410b57e4a5L; + 0xe2afe2434dd9a1e2L; + 0x6199612ff8c24e61L; + 0xb3f6b3f1457b42b3L; + 0x21842115a5423421L; + 0x9c4a9c94d625089cL; + 0x1e781ef0663cee1eL; + 0x4311432252866143L; + 0xc73bc776fc93b1c7L; + 0xfcd7fcb32be54ffcL; + 0x0410042014082404L; + 0x515951b208a2e351L; + 0x995e99bcc72f2599L; + 0x6da96d4fc4da226dL; + 0x0d340d68391a650dL; + 0xfacffa8335e979faL; + 0xdf5bdfb684a369dfL; + 0x7ee57ed79bfca97eL; + 0x2490243db4481924L; + 0x3bec3bc5d776fe3bL; + 0xab96ab313d4b9aabL; + 0xce1fce3ed181f0ceL; + 0x1144118855229911L; + 0x8f068f0c8903838fL; + 0x4e254e4a6b9c044eL; + 0xb7e6b7d1517366b7L; + 0xeb8beb0b60cbe0ebL; + 0x3cf03cfdcc78c13cL; + 0x813e817cbf1ffd81L; + 0x946a94d4fe354094L; + 0xf7fbf7eb0cf31cf7L; + 0xb9deb9a1676f18b9L; + 0x134c13985f268b13L; + 0x2cb02c7d9c58512cL; + 0xd36bd3d6b8bb05d3L; + 0xe7bbe76b5cd38ce7L; + 0x6ea56e57cbdc396eL; + 0xc437c46ef395aac4L; + 0x030c03180f061b03L; + 0x5645568a13acdc56L; + 0x440d441a49885e44L; + 0x7fe17fdf9efea07fL; + 0xa99ea921374f88a9L; + 0x2aa82a4d8254672aL; + 0xbbd6bbb16d6b0abbL; + 0xc123c146e29f87c1L; + 0x535153a202a6f153L; + 0xdc57dcae8ba572dcL; + 0x0b2c0b582716530bL; + 0x9d4e9d9cd327019dL; + 0x6cad6c47c1d82b6cL; + 0x31c43195f562a431L; + 0x74cd7487b9e8f374L; + 0xf6fff6e309f115f6L; + 0x4605460a438c4c46L; + 0xac8aac092645a5acL; + 0x891e893c970fb589L; + 0x145014a04428b414L; + 0xe1a3e15b42dfbae1L; + 0x165816b04e2ca616L; + 0x3ae83acdd274f73aL; + 0x69b9696fd0d20669L; + 0x092409482d124109L; + 0x70dd70a7ade0d770L; + 0xb6e2b6d954716fb6L; + 0xd067d0ceb7bd1ed0L; + 0xed93ed3b7ec7d6edL; + 0xcc17cc2edb85e2ccL; + 0x4215422a57846842L; + 0x985a98b4c22d2c98L; + 0xa4aaa4490e55eda4L; + 0x28a0285d88507528L; + 0x5c6d5cda31b8865cL; + 0xf8c7f8933fed6bf8L; + 0x86228644a411c286L; + |]; + |] - let whirlpool_do_chunk : type a. - be64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = + let whirlpool_do_chunk : + type a. be64_to_cpu:(a -> int -> int64) -> ctx -> a -> int -> unit = fun ~be64_to_cpu ctx buf off -> let key = Array.init 2 (fun _ -> Array.make 8 Int64.zero) in let state = Array.init 2 (fun _ -> Array.make 8 Int64.zero) in let m = ref 0 in let rc = - [| 0x1823c6e887b8014fL; 0x36a6d2f5796f9152L; 0x60bc9b8ea30c7b35L - ; 0x1de0d7c22e4bfe57L; 0x157737e59ff04adaL; 0x58c9290ab1a06b85L - ; 0xbd5d10f4cb3e0567L; 0xe427418ba77d95d8L; 0xfbee7c66dd17479eL - ; 0xca2dbf07ad5a8333L |] - in + [| + 0x1823c6e887b8014fL; + 0x36a6d2f5796f9152L; + 0x60bc9b8ea30c7b35L; + 0x1de0d7c22e4bfe57L; + 0x157737e59ff04adaL; + 0x58c9290ab1a06b85L; + 0xbd5d10f4cb3e0567L; + 0xe427418ba77d95d8L; + 0xfbee7c66dd17479eL; + 0xca2dbf07ad5a8333L; + |] in for i = 0 to 7 do key.(0).(i) <- ctx.h.(i) ; let off = off + (i * 8) in @@ -750,14 +2149,12 @@ module Unsafe : S = struct k.(i).(mask (Int64.shift_right src.((shift + 8 - i) land 7) (56 - (8 * i)))) in - Array.fold_left Int64.logxor Int64.zero (Array.init 8 get_k) - in + Array.fold_left Int64.logxor Int64.zero (Array.init 8 get_k) in for i = 0 to 9 do - let m0, m1 = !m, !m lxor 1 in + let m0, m1 = (!m, !m lxor 1) in let upd_key i = key.(m1).(i) <- wp_op key.(m0) i in let upd_state i = - state.(m1).(i) <- Int64.(wp_op state.(m0) i lxor key.(m1).(i)) - in + state.(m1).(i) <- Int64.(wp_op state.(m0) i lxor key.(m1).(i)) in for i = 0 to 7 do upd_key i done ; @@ -773,26 +2170,28 @@ module Unsafe : S = struct done ; () - let feed : type a. - blit:(a -> int -> By.t -> int -> int -> unit) - -> be64_to_cpu:(a -> int -> int64) - -> ctx - -> a - -> int - -> int - -> unit = + let feed : + type a. + blit:(a -> int -> By.t -> int -> int -> unit) -> + be64_to_cpu:(a -> int -> int64) -> + ctx -> + a -> + int -> + int -> + unit = fun ~blit ~be64_to_cpu ctx buf off len -> let idx = ref Int64.(to_int (ctx.size land 0x3FL)) in let len = ref len in let off = ref off in let to_fill = 64 - !idx in ctx.size <- Int64.add ctx.size (Int64.of_int !len) ; - if !idx <> 0 && !len >= to_fill then ( + if !idx <> 0 && !len >= to_fill + then ( blit buf !off ctx.b !idx to_fill ; whirlpool_do_chunk ~be64_to_cpu:By.be64_to_cpu ctx ctx.b 0 ; len := !len - to_fill ; off := !off + to_fill ; - idx := 0 ) ; + idx := 0) ; while !len >= 64 do whirlpool_do_chunk ~be64_to_cpu ctx buf !off ; len := !len - 64 ; @@ -809,10 +2208,11 @@ module Unsafe : S = struct let unsafe_get ctx = let index = Int64.(to_int (ctx.size land 0x3FL)) + 1 in By.set ctx.b (index - 1) '\x80' ; - if index > 32 then ( + if index > 32 + then ( By.fill ctx.b index (64 - index) '\x00' ; whirlpool_do_chunk ~be64_to_cpu:By.be64_to_cpu ctx ctx.b 0 ; - By.fill ctx.b 0 56 '\x00' ) + By.fill ctx.b 0 56 '\x00') else By.fill ctx.b index (56 - index) '\x00' ; By.cpu_to_be64 ctx.b 56 Int64.(ctx.size lsl 3) ; whirlpool_do_chunk ~be64_to_cpu:By.be64_to_cpu ctx ctx.b 0 ; diff --git a/src-ocaml/digestif.ml b/src-ocaml/digestif.ml index 64c2a58..f67c990 100644 --- a/src-ocaml/digestif.ml +++ b/src-ocaml/digestif.ml @@ -1,9 +1,15 @@ type bigstring = - (char, Bigarray_compat.int8_unsigned_elt, Bigarray_compat.c_layout) Bigarray_compat.Array1.t + ( char, + Bigarray_compat.int8_unsigned_elt, + Bigarray_compat.c_layout ) + Bigarray_compat.Array1.t type 'a iter = ('a -> unit) -> unit + type 'a compare = 'a -> 'a -> int + type 'a equal = 'a -> 'a -> bool + type 'a pp = Format.formatter -> 'a -> unit module By = Digestif_by @@ -18,47 +24,87 @@ module type S = sig val digest_size : int type ctx + type kind + type t val kind : kind + val empty : ctx + val init : unit -> ctx + val feed_bytes : ctx -> ?off:int -> ?len:int -> Bytes.t -> ctx + val feed_string : ctx -> ?off:int -> ?len:int -> String.t -> ctx + val feed_bigstring : ctx -> ?off:int -> ?len:int -> bigstring -> ctx + val feedi_bytes : ctx -> Bytes.t iter -> ctx + val feedi_string : ctx -> String.t iter -> ctx + val feedi_bigstring : ctx -> bigstring iter -> ctx + val get : ctx -> t + val digest_bytes : ?off:int -> ?len:int -> Bytes.t -> t + val digest_string : ?off:int -> ?len:int -> String.t -> t + val digest_bigstring : ?off:int -> ?len:int -> bigstring -> t + val digesti_bytes : Bytes.t iter -> t + val digesti_string : String.t iter -> t + val digesti_bigstring : bigstring iter -> t + val digestv_bytes : Bytes.t list -> t + val digestv_string : String.t list -> t + val digestv_bigstring : bigstring list -> t + val hmac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t + val hmac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t + val hmac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t + val hmaci_bytes : key:Bytes.t -> Bytes.t iter -> t + val hmaci_string : key:String.t -> String.t iter -> t + val hmaci_bigstring : key:bigstring -> bigstring iter -> t + val hmacv_bytes : key:Bytes.t -> Bytes.t list -> t + val hmacv_string : key:String.t -> String.t list -> t + val hmacv_bigstring : key:bigstring -> bigstring list -> t + val unsafe_compare : t compare + val equal : t equal + val pp : t pp + val of_hex : string -> t + val of_hex_opt : string -> t option + val consistent_of_hex : string -> t + val consistent_of_hex_opt : string -> t option + val to_hex : t -> string + val of_raw_string : string -> t + val of_raw_string_opt : string -> t option + val to_raw_string : t -> string end @@ -66,13 +112,21 @@ module type MAC = sig type t val mac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t + val mac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t + val mac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t + val maci_bytes : key:Bytes.t -> Bytes.t iter -> t + val maci_string : key:String.t -> String.t iter -> t + val maci_bigstring : key:bigstring -> bigstring iter -> t + val macv_bytes : key:Bytes.t -> Bytes.t list -> t + val macv_string : key:String.t -> String.t list -> t + val macv_bigstring : key:bigstring -> bigstring list -> t end @@ -80,18 +134,25 @@ module type Desc = sig type kind val digest_size : int + val block_size : int + val kind : kind end module type Hash = sig type ctx + type kind val init : unit -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx end @@ -99,20 +160,22 @@ module Unsafe (Hash : Hash) (D : Desc) = struct open Hash let digest_size = D.digest_size + let block_size = D.block_size + let empty = init () + let init = init let unsafe_feed_bytes ctx ?off ?len buf = let off, len = - match off, len with - | Some off, Some len -> off, len - | Some off, None -> off, By.length buf - off - | None, Some len -> 0, len - | None, None -> 0, By.length buf - in - if off < 0 || len < 0 || off > By.length buf - len then - invalid_arg "offset out of bounds" + match (off, len) with + | Some off, Some len -> (off, len) + | Some off, None -> (off, By.length buf - off) + | None, Some len -> (0, len) + | None, None -> (0, By.length buf) in + if off < 0 || len < 0 || off > By.length buf - len + then invalid_arg "offset out of bounds" else unsafe_feed_bytes ctx buf off len let unsafe_feed_string ctx ?off ?len buf = @@ -120,14 +183,13 @@ module Unsafe (Hash : Hash) (D : Desc) = struct let unsafe_feed_bigstring ctx ?off ?len buf = let off, len = - match off, len with - | Some off, Some len -> off, len - | Some off, None -> off, Bi.length buf - off - | None, Some len -> 0, len - | None, None -> 0, Bi.length buf - in - if off < 0 || len < 0 || off > Bi.length buf - len then - invalid_arg "offset out of bounds" + match (off, len) with + | Some off, Some len -> (off, len) + | Some off, None -> (off, Bi.length buf - off) + | None, Some len -> (0, len) + | None, None -> (0, Bi.length buf) in + if off < 0 || len < 0 || off > Bi.length buf - len + then invalid_arg "offset out of bounds" else unsafe_feed_bigstring ctx buf off len let unsafe_get = unsafe_get @@ -135,7 +197,9 @@ end module Core (Hash : Hash) (D : Desc) = struct type t = string + type ctx = Hash.ctx + type kind = Hash.kind include Unsafe (Hash) (D) @@ -166,29 +230,37 @@ module Core (Hash : Hash) (D : Desc) = struct let feedi_bytes t iter = let t = Hash.dup t in let feed buf = unsafe_feed_bytes t buf in - iter feed ; t + iter feed ; + t let feedi_string t iter = let t = Hash.dup t in let feed buf = unsafe_feed_string t buf in - iter feed ; t + iter feed ; + t let feedi_bigstring t iter = let t = Hash.dup t in let feed buf = unsafe_feed_bigstring t buf in - iter feed ; t + iter feed ; + t let digest_bytes ?off ?len buf = feed_bytes empty ?off ?len buf |> get + let digest_string ?off ?len buf = feed_string empty ?off ?len buf |> get - let digest_bigstring ?off ?len buf = - feed_bigstring empty ?off ?len buf |> get + let digest_bigstring ?off ?len buf = feed_bigstring empty ?off ?len buf |> get let digesti_bytes iter = feedi_bytes empty iter |> get + let digesti_string iter = feedi_string empty iter |> get + let digesti_bigstring iter = feedi_bigstring empty iter |> get + let digestv_bytes lst = digesti_bytes (fun f -> List.iter f lst) + let digestv_string lst = digesti_string (fun f -> List.iter f lst) + let digestv_bigstring lst = digesti_bigstring (fun f -> List.iter f lst) end @@ -196,6 +268,7 @@ module Make (H : Hash) (D : Desc) = struct include Core (H) (D) let bytes_opad = By.init block_size (fun _ -> '\x5c') + let bytes_ipad = By.init block_size (fun _ -> '\x36') let rec norm_bytes key = @@ -205,6 +278,7 @@ module Make (H : Hash) (D : Desc) = struct | _ -> key let bigstring_opad = Bi.init block_size (fun _ -> '\x5c') + let bigstring_ipad = Bi.init block_size (fun _ -> '\x36') let norm_bigstring key = @@ -218,10 +292,13 @@ module Make (H : Hash) (D : Desc) = struct let key = norm_bytes key in let outer = Xor.Bytes.xor key bytes_opad in let inner = Xor.Bytes.xor key bytes_ipad in - let res = digesti_bytes (fun f -> f inner ; iter f) in + let res = + digesti_bytes (fun f -> + f inner ; + iter f) in digesti_bytes (fun f -> f outer ; - f (By.unsafe_of_string res) ) + f (By.unsafe_of_string res)) let hmaci_string ~key iter = let key = norm_bytes (By.unsafe_of_string key) in @@ -237,41 +314,42 @@ module Make (H : Hash) (D : Desc) = struct let key = norm_bigstring key in let outer = Xor.Bigstring.xor key bigstring_opad in let inner = Xor.Bigstring.xor key bigstring_ipad in - let res = digesti_bigstring (fun f -> f inner ; iter f) in + let res = + digesti_bigstring (fun f -> + f inner ; + iter f) in let ctx = feed_bigstring empty outer in feed_string ctx (res :> string) |> get let hmac_bytes ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> By.sub buf off len | Some off, None -> By.sub buf off (By.length buf - off) | None, Some len -> By.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_bytes ~key (fun f -> f buf) let hmac_string ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> String.sub buf off len | Some off, None -> String.sub buf off (String.length buf - off) | None, Some len -> String.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_string ~key (fun f -> f buf) let hmac_bigstring ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> Bi.sub buf off len | Some off, None -> Bi.sub buf off (Bi.length buf - off) | None, Some len -> Bi.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in hmaci_bigstring ~key (fun f -> f buf) let hmacv_bytes ~key bufs = hmaci_bytes ~key (fun f -> List.iter f bufs) + let hmacv_string ~key bufs = hmaci_string ~key (fun f -> List.iter f bufs) let hmacv_bigstring ~key bufs = @@ -280,32 +358,49 @@ end module type Hash_BLAKE2 = sig type ctx + type kind val with_outlen_and_bytes_key : int -> By.t -> int -> int -> ctx + val with_outlen_and_bigstring_key : int -> Bi.t -> int -> int -> ctx + val unsafe_feed_bytes : ctx -> By.t -> int -> int -> unit + val unsafe_feed_bigstring : ctx -> Bi.t -> int -> int -> unit + val unsafe_get : ctx -> By.t + val dup : ctx -> ctx + val max_outlen : int end module Make_BLAKE2 (H : Hash_BLAKE2) (D : Desc) = struct let () = if D.digest_size > H.max_outlen - then failwith "Invalid digest_size:%d to make a BLAKE2{S,B} implementation" D.digest_size + then + failwith "Invalid digest_size:%d to make a BLAKE2{S,B} implementation" + D.digest_size + + include Make + (struct + type ctx = H.ctx + + type kind = H.kind - include Make (struct - type ctx = H.ctx - type kind = H.kind + let init () = + H.with_outlen_and_bytes_key D.digest_size By.empty 0 0 - let init () = H.with_outlen_and_bytes_key D.digest_size By.empty 0 0 - let unsafe_feed_bytes = H.unsafe_feed_bytes - let unsafe_feed_bigstring = H.unsafe_feed_bigstring - let unsafe_get = H.unsafe_get - let dup = H.dup - end) (D) + let unsafe_feed_bytes = H.unsafe_feed_bytes + + let unsafe_feed_bigstring = H.unsafe_feed_bigstring + + let unsafe_get = H.unsafe_get + + let dup = H.dup + end) + (D) type outer = t @@ -313,55 +408,49 @@ module Make_BLAKE2 (H : Hash_BLAKE2) (D : Desc) = struct type t = outer let maci_bytes ~key iter = - let ctx = - H.with_outlen_and_bytes_key digest_size key 0 (By.length key) - in + let ctx = H.with_outlen_and_bytes_key digest_size key 0 (By.length key) in feedi_bytes ctx iter |> get let maci_string ~key iter = let ctx = H.with_outlen_and_bytes_key digest_size (By.unsafe_of_string key) 0 - (String.length key) - in + (String.length key) in feedi_string ctx iter |> get let maci_bigstring ~key iter = let ctx = - H.with_outlen_and_bigstring_key digest_size key 0 (Bi.length key) - in + H.with_outlen_and_bigstring_key digest_size key 0 (Bi.length key) in feedi_bigstring ctx iter |> get let mac_bytes ~key ?off ?len buf : t = let buf = - match off, len with + match (off, len) with | Some off, Some len -> By.sub buf off len | Some off, None -> By.sub buf off (By.length buf - off) | None, Some len -> By.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_bytes ~key (fun f -> f buf) let mac_string ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> String.sub buf off len | Some off, None -> String.sub buf off (String.length buf - off) | None, Some len -> String.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_string ~key (fun f -> f buf) let mac_bigstring ~key ?off ?len buf = let buf = - match off, len with + match (off, len) with | Some off, Some len -> Bi.sub buf off len | Some off, None -> Bi.sub buf off (Bi.length buf - off) | None, Some len -> Bi.sub buf 0 len - | None, None -> buf - in + | None, None -> buf in maci_bigstring ~key (fun f -> f buf) let macv_bytes ~key bufs = maci_bytes ~key (fun f -> List.iter f bufs) + let macv_string ~key bufs = maci_string ~key (fun f -> List.iter f bufs) let macv_bigstring ~key bufs = @@ -369,131 +458,133 @@ module Make_BLAKE2 (H : Hash_BLAKE2) (D : Desc) = struct end end -module MD5 : S with type kind = [`MD5] = +module MD5 : S with type kind = [ `MD5 ] = Make (Baijiu_md5.Unsafe) (struct - let digest_size, block_size = 16, 64 + let digest_size, block_size = (16, 64) - type kind = [`MD5] + type kind = [ `MD5 ] let kind = `MD5 end) -module SHA1 : S with type kind = [`SHA1] = +module SHA1 : S with type kind = [ `SHA1 ] = Make (Baijiu_sha1.Unsafe) (struct - let digest_size, block_size = 20, 64 + let digest_size, block_size = (20, 64) - type kind = [`SHA1] + type kind = [ `SHA1 ] let kind = `SHA1 end) -module SHA224 : S with type kind = [`SHA224] = +module SHA224 : S with type kind = [ `SHA224 ] = Make (Baijiu_sha224.Unsafe) (struct - let digest_size, block_size = 28, 64 + let digest_size, block_size = (28, 64) - type kind = [`SHA224] + type kind = [ `SHA224 ] let kind = `SHA224 end) -module SHA256 : S with type kind = [`SHA256] = +module SHA256 : S with type kind = [ `SHA256 ] = Make (Baijiu_sha256.Unsafe) (struct - let digest_size, block_size = 32, 64 + let digest_size, block_size = (32, 64) - type kind = [`SHA256] + type kind = [ `SHA256 ] let kind = `SHA256 end) -module SHA384 : S with type kind = [`SHA384] = +module SHA384 : S with type kind = [ `SHA384 ] = Make (Baijiu_sha384.Unsafe) (struct - let digest_size, block_size = 48, 128 + let digest_size, block_size = (48, 128) - type kind = [`SHA384] + type kind = [ `SHA384 ] let kind = `SHA384 end) -module SHA512 : S with type kind = [`SHA512] = +module SHA512 : S with type kind = [ `SHA512 ] = Make (Baijiu_sha512.Unsafe) (struct - let digest_size, block_size = 64, 128 + let digest_size, block_size = (64, 128) - type kind = [`SHA512] + type kind = [ `SHA512 ] let kind = `SHA512 end) -module WHIRLPOOL : S with type kind = [`WHIRLPOOL] = +module WHIRLPOOL : S with type kind = [ `WHIRLPOOL ] = Make (Baijiu_whirlpool.Unsafe) (struct - let digest_size, block_size = 64, 64 + let digest_size, block_size = (64, 64) - type kind = [`WHIRLPOOL] + type kind = [ `WHIRLPOOL ] let kind = `WHIRLPOOL end) module BLAKE2B : sig - include S with type kind = [`BLAKE2B] + include S with type kind = [ `BLAKE2B ] + module Keyed : MAC with type t = t end = Make_BLAKE2 (Baijiu_blake2b.Unsafe) (struct - let digest_size, block_size = 64, 128 + let digest_size, block_size = (64, 128) - type kind = [`BLAKE2B] + type kind = [ `BLAKE2B ] let kind = `BLAKE2B end) module BLAKE2S : sig - include S with type kind = [`BLAKE2S] + include S with type kind = [ `BLAKE2S ] + module Keyed : MAC with type t = t end = Make_BLAKE2 (Baijiu_blake2s.Unsafe) (struct - let digest_size, block_size = 32, 64 + let digest_size, block_size = (32, 64) - type kind = [`BLAKE2S] + type kind = [ `BLAKE2S ] let kind = `BLAKE2S end) -module RMD160 : S with type kind = [`RMD160] = +module RMD160 : S with type kind = [ `RMD160 ] = Make (Baijiu_rmd160.Unsafe) (struct - let digest_size, block_size = 20, 64 + let digest_size, block_size = (20, 64) - type kind = [`RMD160] + type kind = [ `RMD160 ] let kind = `RMD160 end) module Make_BLAKE2B (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2B] = struct +end) : S with type kind = [ `BLAKE2B ] = struct include Make_BLAKE2 (Baijiu_blake2b.Unsafe) (struct - let digest_size, block_size = D.digest_size, 128 + let digest_size, block_size = (D.digest_size, 128) - type kind = [`BLAKE2B] + type kind = [ `BLAKE2B ] let kind = `BLAKE2B end) @@ -501,13 +592,13 @@ end module Make_BLAKE2S (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2S] = struct +end) : S with type kind = [ `BLAKE2S ] = struct include Make_BLAKE2 (Baijiu_blake2s.Unsafe) (struct - let digest_size, block_size = D.digest_size, 64 + let digest_size, block_size = (D.digest_size, 64) - type kind = [`BLAKE2S] + type kind = [ `BLAKE2S ] let kind = `BLAKE2S end) @@ -515,8 +606,9 @@ end include Hash -type blake2b = (module S with type kind = [`BLAKE2B]) -type blake2s = (module S with type kind = [`BLAKE2S]) +type blake2b = (module S with type kind = [ `BLAKE2B ]) + +type blake2s = (module S with type kind = [ `BLAKE2S ]) let module_of : type k. k hash -> (module S with type kind = k) = fun hash -> @@ -532,29 +624,27 @@ let module_of : type k. k hash -> (module S with type kind = k) = | SHA512 -> (module SHA512) | WHIRLPOOL -> (module WHIRLPOOL) | BLAKE2B digest_size -> ( - match Hashtbl.find b2b digest_size with - | exception Not_found -> - let m : (module S with type kind = [`BLAKE2B]) = - (module Make_BLAKE2B (struct let digest_size = digest_size - end) - : S - with type kind = [`BLAKE2B] ) - in - Hashtbl.replace b2b digest_size m ; - m - | m -> m ) - | BLAKE2S digest_size -> ( - match Hashtbl.find b2s digest_size with - | exception Not_found -> - let m = - (module Make_BLAKE2S (struct let digest_size = digest_size - end) - : S - with type kind = [`BLAKE2S] ) - in - Hashtbl.replace b2s digest_size m ; - m - | m -> m ) + match Hashtbl.find b2b digest_size with + | exception Not_found -> + let m : (module S with type kind = [ `BLAKE2B ]) = + (module Make_BLAKE2B (struct + let digest_size = digest_size + end) : S + with type kind = [ `BLAKE2B ]) in + Hashtbl.replace b2b digest_size m ; + m + | m -> m) + | BLAKE2S digest_size -> + match Hashtbl.find b2s digest_size with + | exception Not_found -> + let m = + (module Make_BLAKE2S (struct + let digest_size = digest_size + end) : S + with type kind = [ `BLAKE2S ]) in + Hashtbl.replace b2s digest_size m ; + m + | m -> m type 'kind t = string @@ -598,8 +688,7 @@ let hmaci_string : type k. k hash -> key:String.t -> String.t iter -> k t = let module H = (val module_of hash) in (H.to_raw_string (H.hmaci_string ~key iter) : H.kind t) -let hmaci_bigstring : type k. k hash -> key:bigstring -> bigstring iter -> k t - = +let hmaci_bigstring : type k. k hash -> key:bigstring -> bigstring iter -> k t = fun hash ~key iter -> let module H = (val module_of hash) in (H.to_raw_string (H.hmaci_bigstring ~key iter) : H.kind t) @@ -671,17 +760,24 @@ let of_raw_string_opt : type k. k hash -> string -> k t option = let to_raw_string : type k. k hash -> k t -> string = fun _ t -> t let of_digest (type hash kind) - (module H : S with type t = hash and type kind = kind) (hash : H.t) : - kind t = + (module H : S with type t = hash and type kind = kind) (hash : H.t) : kind t + = H.to_raw_string hash let of_md5 hash = of_raw_string md5 (MD5.to_raw_string hash) + let of_sha1 hash = of_raw_string sha1 (SHA1.to_raw_string hash) + let of_rmd160 hash = of_raw_string rmd160 (RMD160.to_raw_string hash) + let of_sha224 hash = of_raw_string sha224 (SHA224.to_raw_string hash) + let of_sha256 hash = of_raw_string sha256 (SHA256.to_raw_string hash) + let of_sha384 hash = of_raw_string sha384 (SHA384.to_raw_string hash) + let of_sha512 hash = of_raw_string sha512 (SHA512.to_raw_string hash) + let of_whirlpool hash = of_raw_string whirlpool (WHIRLPOOL.to_raw_string hash) let of_blake2b hash = diff --git a/src-ocaml/xor.ml b/src-ocaml/xor.ml index 4744bad..966e649 100644 --- a/src-ocaml/xor.ml +++ b/src-ocaml/xor.ml @@ -1,14 +1,20 @@ -module Nat = struct include Nativeint +module Nat = struct + include Nativeint - let ( lxor ) = Nativeint.logxor end + let ( lxor ) = Nativeint.logxor +end module type BUFFER = sig type t val length : t -> int + val sub : t -> int -> int -> t + val copy : t -> t + val benat_to_cpu : t -> int -> nativeint + val cpu_to_benat : t -> int -> nativeint -> unit end @@ -40,14 +46,15 @@ module Make (B : BUFFER) = struct done let xor_into a b n = - if n > imin (B.length a) (B.length b) then - raise (Invalid_argument "Baijiu.Xor.xor_inrot: buffers to small") + if n > imin (B.length a) (B.length b) + then raise (Invalid_argument "Baijiu.Xor.xor_inrot: buffers to small") else xor_into a 0 b 0 n let xor a b = let l = imin (B.length a) (B.length b) in let r = B.copy (B.sub b 0 l) in - xor_into a r l ; r + xor_into a r l ; + r end module Bytes = Make (Digestif_by) diff --git a/src/digestif.mli b/src/digestif.mli index d78ac1f..88f47d8 100644 --- a/src/digestif.mli +++ b/src/digestif.mli @@ -1,16 +1,21 @@ type bigstring = - (char, Bigarray_compat.int8_unsigned_elt, Bigarray_compat.c_layout) Bigarray_compat.Array1.t + ( char, + Bigarray_compat.int8_unsigned_elt, + Bigarray_compat.c_layout ) + Bigarray_compat.Array1.t -(** A general (inner) iterator. It applies the provided function to a - collection of elements. For instance: - - {ul {- [let iter_k : 'a -> 'a iter = fun x f -> f x]} {- [let iter_pair : - 'a * 'a -> 'a iter = fun (x, y) -> f x; f y]} {- [let iter_list : 'a list - -> 'a iter = fun l f -> List.iter f l]}} *) type 'a iter = ('a -> unit) -> unit +(** A general (inner) iterator. It applies the provided function to a collection + of elements. For instance: + + - [let iter_k : 'a -> 'a iter = fun x f -> f x] + - [let iter_pair : 'a * 'a -> 'a iter = fun (x, y) -> f x; f y] + - [let iter_list : 'a list -> 'a iter = fun l f -> List.iter f l] *) type 'a compare = 'a -> 'a -> int + type 'a equal = 'a -> 'a -> bool + type 'a pp = Format.formatter -> 'a -> unit module type S = sig @@ -18,7 +23,9 @@ module type S = sig (** Size of hash results, in bytes. *) type ctx + type kind + type t val kind : kind @@ -41,8 +48,8 @@ module type S = sig (** Same as {!feed_bytes} but for {!bigstring}. *) val feedi_bytes : ctx -> Bytes.t iter -> ctx - (** [feedi_bytes t iter = let r = ref t in iter (fun msg -> r := feed !r - msg); !r] *) + (** [feedi_bytes t iter = let r = ref t in iter (fun msg -> r := feed !r msg); + !r] *) val feedi_string : ctx -> String.t iter -> ctx (** Same as {!feed_bytes} but for {!String.t}. *) @@ -85,8 +92,8 @@ module type S = sig val hmac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t (** [hmac_bytes ~key bytes] is the authentication code for {!Bytes.t} under - the secret [key], generated using the standard HMAC construction over - this hash algorithm. *) + the secret [key], generated using the standard HMAC construction over this + hash algorithm. *) val hmac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t (** Same as {!hmac_bytes} but for {!String.t}. *) @@ -147,8 +154,8 @@ module type S = sig val consistent_of_hex_opt : string -> t option (** [consistent_of_hex_opt] tries to parse an hexadecimal representation of - {!t}. [consistent_of_hex] returns [None] when input is malformed. - However, instead {!of_hex}, [consistent_of_hex] expects exactly + {!t}. [consistent_of_hex] returns [None] when input is malformed. However, + instead {!of_hex}, [consistent_of_hex] expects exactly [{!digest_size} * 2] hexadecimal values (but continues to ignore whitespaces). *) @@ -173,13 +180,21 @@ module type MAC = sig type t val mac_bytes : key:Bytes.t -> ?off:int -> ?len:int -> Bytes.t -> t + val mac_string : key:String.t -> ?off:int -> ?len:int -> String.t -> t + val mac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t + val maci_bytes : key:Bytes.t -> Bytes.t iter -> t + val maci_string : key:String.t -> String.t iter -> t + val maci_bigstring : key:bigstring -> bigstring iter -> t + val macv_bytes : key:Bytes.t -> Bytes.t list -> t + val macv_string : key:String.t -> String.t list -> t + val macv_bigstring : key:bigstring -> bigstring list -> t end @@ -196,90 +211,136 @@ type kind = | `BLAKE2S ] type 'k hash = - | MD5 : [`MD5] hash - | SHA1 : [`SHA1] hash - | RMD160 : [`RMD160] hash - | SHA224 : [`SHA224] hash - | SHA256 : [`SHA256] hash - | SHA384 : [`SHA384] hash - | SHA512 : [`SHA512] hash - | WHIRLPOOL : [`WHIRLPOOL] hash - | BLAKE2B : int -> [`BLAKE2B] hash - | BLAKE2S : int -> [`BLAKE2S] hash - -module MD5 : S with type kind = [`MD5] -module SHA1 : S with type kind = [`SHA1] -module SHA224 : S with type kind = [`SHA224] -module SHA256 : S with type kind = [`SHA256] -module SHA384 : S with type kind = [`SHA384] -module SHA512 : S with type kind = [`SHA512] -module WHIRLPOOL : S with type kind = [`WHIRLPOOL] + | MD5 : [ `MD5 ] hash + | SHA1 : [ `SHA1 ] hash + | RMD160 : [ `RMD160 ] hash + | SHA224 : [ `SHA224 ] hash + | SHA256 : [ `SHA256 ] hash + | SHA384 : [ `SHA384 ] hash + | SHA512 : [ `SHA512 ] hash + | WHIRLPOOL : [ `WHIRLPOOL ] hash + | BLAKE2B : int -> [ `BLAKE2B ] hash + | BLAKE2S : int -> [ `BLAKE2S ] hash + +module MD5 : S with type kind = [ `MD5 ] + +module SHA1 : S with type kind = [ `SHA1 ] + +module SHA224 : S with type kind = [ `SHA224 ] + +module SHA256 : S with type kind = [ `SHA256 ] + +module SHA384 : S with type kind = [ `SHA384 ] + +module SHA512 : S with type kind = [ `SHA512 ] + +module WHIRLPOOL : S with type kind = [ `WHIRLPOOL ] module BLAKE2B : sig - include S with type kind = [`BLAKE2B] + include S with type kind = [ `BLAKE2B ] + module Keyed : MAC with type t = t end module BLAKE2S : sig - include S with type kind = [`BLAKE2S] + include S with type kind = [ `BLAKE2S ] + module Keyed : MAC with type t = t end -module RMD160 : S with type kind = [`RMD160] +module RMD160 : S with type kind = [ `RMD160 ] module Make_BLAKE2B (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2B] +end) : S with type kind = [ `BLAKE2B ] module Make_BLAKE2S (D : sig val digest_size : int -end) : S with type kind = [`BLAKE2S] - -val md5 : [`MD5] hash -val sha1 : [`SHA1] hash -val rmd160 : [`RMD160] hash -val sha224 : [`SHA224] hash -val sha256 : [`SHA256] hash -val sha384 : [`SHA384] hash -val sha512 : [`SHA512] hash -val whirlpool : [`WHIRLPOOL] hash -val blake2b : int -> [`BLAKE2B] hash -val blake2s : int -> [`BLAKE2S] hash +end) : S with type kind = [ `BLAKE2S ] + +val md5 : [ `MD5 ] hash + +val sha1 : [ `SHA1 ] hash + +val rmd160 : [ `RMD160 ] hash + +val sha224 : [ `SHA224 ] hash + +val sha256 : [ `SHA256 ] hash + +val sha384 : [ `SHA384 ] hash + +val sha512 : [ `SHA512 ] hash + +val whirlpool : [ `WHIRLPOOL ] hash + +val blake2b : int -> [ `BLAKE2B ] hash + +val blake2s : int -> [ `BLAKE2S ] hash type 'kind t val module_of : 'k hash -> (module S with type kind = 'k) + val digest_bytes : 'k hash -> Bytes.t -> 'k t + val digest_string : 'k hash -> String.t -> 'k t + val digest_bigstring : 'k hash -> bigstring -> 'k t + val digesti_bytes : 'k hash -> Bytes.t iter -> 'k t + val digesti_string : 'k hash -> String.t iter -> 'k t + val digesti_bigstring : 'k hash -> bigstring iter -> 'k t + val hmaci_bytes : 'k hash -> key:Bytes.t -> Bytes.t iter -> 'k t + val hmaci_string : 'k hash -> key:String.t -> String.t iter -> 'k t + val hmaci_bigstring : 'k hash -> key:bigstring -> bigstring iter -> 'k t + val pp : 'k hash -> 'k t pp + val equal : 'k hash -> 'k t equal + val unsafe_compare : 'k hash -> 'k t compare + val to_hex : 'k hash -> 'k t -> string + val of_hex : 'k hash -> string -> 'k t + val of_hex_opt : 'k hash -> string -> 'k t option + val consistent_of_hex : 'k hash -> string -> 'k t + val consistent_of_hex_opt : 'k hash -> string -> 'k t option + val of_raw_string : 'k hash -> string -> 'k t + val of_raw_string_opt : 'k hash -> string -> 'k t option + val to_raw_string : 'k hash -> 'k t -> string val of_digest : (module S with type t = 'hash and type kind = 'k) -> 'hash -> 'k t -val of_md5 : MD5.t -> [`MD5] t -val of_sha1 : SHA1.t -> [`SHA1] t -val of_rmd160 : RMD160.t -> [`RMD160] t -val of_sha224 : SHA224.t -> [`SHA224] t -val of_sha256 : SHA256.t -> [`SHA256] t -val of_sha384 : SHA384.t -> [`SHA384] t -val of_sha512 : SHA512.t -> [`SHA512] t -val of_whirlpool : WHIRLPOOL.t -> [`WHIRLPOOL] t -val of_blake2b : BLAKE2B.t -> [`BLAKE2B] t -val of_blake2s : BLAKE2S.t -> [`BLAKE2S] t +val of_md5 : MD5.t -> [ `MD5 ] t + +val of_sha1 : SHA1.t -> [ `SHA1 ] t + +val of_rmd160 : RMD160.t -> [ `RMD160 ] t + +val of_sha224 : SHA224.t -> [ `SHA224 ] t + +val of_sha256 : SHA256.t -> [ `SHA256 ] t + +val of_sha384 : SHA384.t -> [ `SHA384 ] t + +val of_sha512 : SHA512.t -> [ `SHA512 ] t + +val of_whirlpool : WHIRLPOOL.t -> [ `WHIRLPOOL ] t + +val of_blake2b : BLAKE2B.t -> [ `BLAKE2B ] t + +val of_blake2s : BLAKE2S.t -> [ `BLAKE2S ] t diff --git a/src/digestif_bi.ml b/src/digestif_bi.ml index 2f4d69a..571b509 100644 --- a/src/digestif_bi.ml +++ b/src/digestif_bi.ml @@ -3,13 +3,17 @@ open Bigarray_compat type t = (char, int8_unsigned_elt, c_layout) Array1.t let create n = Array1.create Char c_layout n + let length = Array1.dim + let sub = Array1.sub + let empty = Array1.create Char c_layout 0 let copy t = let r = create (length t) in - Array1.blit t r ; r + Array1.blit t r ; + r let init l f = let v = Array1.create Char c_layout l in @@ -19,19 +23,23 @@ let init l f = v external unsafe_get_32 : t -> int -> int32 = "%caml_bigstring_get32u" + external unsafe_get_64 : t -> int -> int64 = "%caml_bigstring_get64u" let unsafe_get_nat : t -> int -> nativeint = fun s i -> - if Sys.word_size = 32 then Nativeint.of_int32 @@ unsafe_get_32 s i + if Sys.word_size = 32 + then Nativeint.of_int32 @@ unsafe_get_32 s i else Int64.to_nativeint @@ unsafe_get_64 s i external unsafe_set_32 : t -> int -> int32 -> unit = "%caml_bigstring_set32u" + external unsafe_set_64 : t -> int -> int64 -> unit = "%caml_bigstring_set64u" let unsafe_set_nat : t -> int -> nativeint -> unit = fun s i v -> - if Sys.word_size = 32 then unsafe_set_32 s i (Nativeint.to_int32 v) + if Sys.word_size = 32 + then unsafe_set_32 s i (Nativeint.to_int32 v) else unsafe_set_64 s i (Int64.of_nativeint v) let to_string v = String.init (length v) (Array1.get v) @@ -42,7 +50,9 @@ let blit_from_bytes src src_off dst dst_off len = done external swap32 : int32 -> int32 = "%bswap_int32" + external swap64 : int64 -> int64 = "%bswap_int64" + external swapnat : nativeint -> nativeint = "%bswap_native" let cpu_to_be32 s i v = @@ -73,5 +83,6 @@ let benat_to_cpu s i = if Sys.big_endian then unsafe_get_nat s i else swapnat @@ unsafe_get_nat s i let cpu_to_benat s i v = - if Sys.big_endian then unsafe_set_nat s i v + if Sys.big_endian + then unsafe_set_nat s i v else unsafe_set_nat s i (swapnat v) diff --git a/src/digestif_by.ml b/src/digestif_by.ml index 333a9b7..cda1b04 100644 --- a/src/digestif_by.ml +++ b/src/digestif_by.ml @@ -1,24 +1,28 @@ include Bytes external unsafe_get_32 : t -> int -> int32 = "%caml_string_get32u" + external unsafe_get_64 : t -> int -> int64 = "%caml_string_get64u" let unsafe_get_nat : t -> int -> nativeint = fun s i -> - if Sys.word_size = 32 then Nativeint.of_int32 @@ unsafe_get_32 s i + if Sys.word_size = 32 + then Nativeint.of_int32 @@ unsafe_get_32 s i else Int64.to_nativeint @@ unsafe_get_64 s i external unsafe_set_32 : t -> int -> int32 -> unit = "%caml_string_set32u" + external unsafe_set_64 : t -> int -> int64 -> unit = "%caml_string_set64u" let unsafe_set_nat : t -> int -> nativeint -> unit = fun s i v -> - if Sys.word_size = 32 then unsafe_set_32 s i (Nativeint.to_int32 v) + if Sys.word_size = 32 + then unsafe_set_32 s i (Nativeint.to_int32 v) else unsafe_set_64 s i (Int64.of_nativeint v) let blit_from_bigstring src src_off dst dst_off len = for i = 0 to len - 1 do - set dst (dst_off + i) (src.{(src_off + i)}) + set dst (dst_off + i) src.{src_off + i} done let rpad a size x = @@ -29,7 +33,9 @@ let rpad a size x = b external swap32 : int32 -> int32 = "%bswap_int32" + external swap64 : int64 -> int64 = "%bswap_int64" + external swapnat : nativeint -> nativeint = "%bswap_native" let cpu_to_be32 s i v = @@ -60,5 +66,6 @@ let benat_to_cpu s i = if Sys.big_endian then unsafe_get_nat s i else swapnat @@ unsafe_get_nat s i let cpu_to_benat s i v = - if Sys.big_endian then unsafe_set_nat s i v + if Sys.big_endian + then unsafe_set_nat s i v else unsafe_set_nat s i (swapnat v) diff --git a/src/digestif_conv.ml b/src/digestif_conv.ml index c02b6d6..ee7bd38 100644 --- a/src/digestif_conv.ml +++ b/src/digestif_conv.ml @@ -9,8 +9,7 @@ struct let chr x = match x with | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 -> Char.chr (48 + x) - | _ -> Char.chr (97 + (x - 10)) - in + | _ -> Char.chr (97 + (x - 10)) in for i = 0 to D.digest_size - 1 do let v = Char.code hash.[i] in Bytes.unsafe_set res (i * 2) (chr (v lsr 4)) ; @@ -30,17 +29,20 @@ struct let of_hex hex = let offset = ref 0 in let rec go have_first idx = - if !offset + idx >= String.length hex then '\x00' + if !offset + idx >= String.length hex + then '\x00' else match hex.[!offset + idx] with - | ' ' | '\t' | '\r' | '\n' -> incr offset ; go have_first idx + | ' ' | '\t' | '\r' | '\n' -> + incr offset ; + go have_first idx | chr2 when have_first -> chr2 | chr1 -> incr offset ; let chr2 = go true idx in - if chr2 <> '\x00' then decode chr1 chr2 - else invalid_arg "of_hex: odd number of hex characters" - in + if chr2 <> '\x00' + then decode chr1 chr2 + else invalid_arg "of_hex: odd number of hex characters" in String.init D.digest_size (go false) let of_hex_opt hex = @@ -51,17 +53,18 @@ struct let consistent_of_hex str = let offset = ref 0 in let rec go have_first idx = - if !offset + idx >= String.length str then - invalid_arg "Not enough hex value" + if !offset + idx >= String.length str + then invalid_arg "Not enough hex value" else match str.[!offset + idx] with - | ' ' | '\t' | '\r' | '\n' -> incr offset ; go have_first idx + | ' ' | '\t' | '\r' | '\n' -> + incr offset ; + go have_first idx | chr2 when have_first -> chr2 | chr1 -> incr offset ; let chr2 = go true idx in - decode chr1 chr2 - in + decode chr1 chr2 in let res = String.init D.digest_size (go false) in let is_wsp = function ' ' | '\t' | '\r' | '\n' -> true | _ -> false in while @@ -70,7 +73,8 @@ struct do incr offset done ; - if !offset + D.digest_size = String.length str then res + if !offset + D.digest_size = String.length str + then res else invalid_arg "Too much enough bytes (reach: %d, expect: %d)" (!offset + (D.digest_size * 2)) @@ -87,7 +91,8 @@ struct done let of_raw_string x = - if String.length x <> D.digest_size then invalid_arg "invalid hash size" + if String.length x <> D.digest_size + then invalid_arg "invalid hash size" else x let of_raw_string_opt x = diff --git a/src/digestif_eq.ml b/src/digestif_eq.ml index 3420863..8ac6660 100644 --- a/src/digestif_eq.ml +++ b/src/digestif_eq.ml @@ -3,6 +3,8 @@ module Make (D : sig end) = struct let _ = D.digest_size + let equal a b = Eqaf.equal a b + let unsafe_compare a b = String.compare a b end diff --git a/src/digestif_hash.ml b/src/digestif_hash.ml index 6d22066..d63fbfc 100644 --- a/src/digestif_hash.ml +++ b/src/digestif_hash.ml @@ -1,14 +1,14 @@ type 'kind hash = - | MD5 : [`MD5] hash - | SHA1 : [`SHA1] hash - | RMD160 : [`RMD160] hash - | SHA224 : [`SHA224] hash - | SHA256 : [`SHA256] hash - | SHA384 : [`SHA384] hash - | SHA512 : [`SHA512] hash - | WHIRLPOOL : [`WHIRLPOOL] hash - | BLAKE2B : int -> [`BLAKE2B] hash - | BLAKE2S : int -> [`BLAKE2S] hash + | MD5 : [ `MD5 ] hash + | SHA1 : [ `SHA1 ] hash + | RMD160 : [ `RMD160 ] hash + | SHA224 : [ `SHA224 ] hash + | SHA256 : [ `SHA256 ] hash + | SHA384 : [ `SHA384 ] hash + | SHA512 : [ `SHA512 ] hash + | WHIRLPOOL : [ `WHIRLPOOL ] hash + | BLAKE2B : int -> [ `BLAKE2B ] hash + | BLAKE2S : int -> [ `BLAKE2S ] hash and kind = [ `MD5 @@ -23,12 +23,21 @@ and kind = | `BLAKE2S ] let md5 = MD5 + let sha1 = SHA1 + let rmd160 = RMD160 + let sha224 = SHA224 + let sha256 = SHA256 + let sha384 = SHA384 + let sha512 = SHA512 + let whirlpool = WHIRLPOOL + let blake2b length = BLAKE2B length + let blake2s length = BLAKE2S length diff --git a/test/conv/test_conv.ml b/test/conv/test_conv.ml index 2c892c8..98dbb43 100644 --- a/test/conv/test_conv.ml +++ b/test/conv/test_conv.ml @@ -1,29 +1,33 @@ external random_seed : unit -> int array = "caml_sys_random_seed" let seed = random_seed () + let () = Random.full_init seed + let () = Fmt.epr "seed: %a.\n%!" Fmt.(Dump.array int) seed + let strf = Fmt.strf + let invalid_arg = Fmt.invalid_arg let list_init f l = let rec go acc = function | 0 -> List.rev acc - | n -> go (f n :: acc) (pred n) - in + | n -> go (f n :: acc) (pred n) in go [] l let random_string length _ = let ic = open_in_bin "/dev/urandom" in let rs = really_input_string ic length in - close_in ic ; rs + close_in ic ; + rs let hashes = list_init (random_string Digestif.SHA1.digest_size) 32 + let hashes = List.map Digestif.SHA1.of_raw_string hashes let consistent_hex = - List.map Digestif.SHA1.to_hex - (* XXX(dinosaure): an oracle [to_hex]? *) hashes + List.map Digestif.SHA1.to_hex (* XXX(dinosaure): an oracle [to_hex]? *) hashes let random_wsp length = let go _ = @@ -32,14 +36,13 @@ let random_wsp length = | 1 -> '\t' | 2 -> '\n' | 3 -> '\r' - | _ -> assert false - in + | _ -> assert false in String.init length go let spaces_expand hex = let rt = ref [] in String.iter - (fun chr -> rt := !rt @ [random_wsp (Random.int 10); String.make 1 chr]) + (fun chr -> rt := !rt @ [ random_wsp (Random.int 10); String.make 1 chr ]) hex ; String.concat "" !rt @@ -50,28 +53,26 @@ let random_hex length = match Random.int (10 + 26 + 26) with | n when n < 10 -> Char.chr (Char.code '0' + n) | n when n < 10 + 26 -> Char.chr (Char.code 'a' + n - 10) - | n -> Char.chr (Char.code 'A' + n - (10 + 26)) - in + | n -> Char.chr (Char.code 'A' + n - (10 + 26)) in String.init length go let inconsistent_hex = let expand hex = String.concat "" - [spaces_expand hex; spaces_expand (random_hex (5 + Random.int 20))] + [ spaces_expand hex; spaces_expand (random_hex (5 + Random.int 20)) ] in List.map expand consistent_hex let test_consistent_hex_success i hex = - Alcotest.test_case (strf "consistent hex:%d" i) `Quick - @@ fun () -> ignore @@ Digestif.SHA1.consistent_of_hex hex + Alcotest.test_case (strf "consistent hex:%d" i) `Quick @@ fun () -> + ignore @@ Digestif.SHA1.consistent_of_hex hex let test_hex_success i hex = - Alcotest.test_case (strf "hex:%d" i) `Quick - @@ fun () -> ignore @@ Digestif.SHA1.of_hex hex + Alcotest.test_case (strf "hex:%d" i) `Quick @@ fun () -> + ignore @@ Digestif.SHA1.of_hex hex let test_consistent_hex_fail i hex = - Alcotest.test_case (strf "consistent hex fail:%d" i) `Quick - @@ fun () -> + Alcotest.test_case (strf "consistent hex fail:%d" i) `Quick @@ fun () -> try let _ = Digestif.SHA1.consistent_of_hex hex in assert false @@ -80,15 +81,13 @@ let test_consistent_hex_fail i hex = let sha1 = Alcotest.testable Digestif.SHA1.pp Digestif.SHA1.equal let test_hex_iso i random_input = - Alcotest.test_case (strf "iso:%d" i) `Quick - @@ fun () -> + Alcotest.test_case (strf "iso:%d" i) `Quick @@ fun () -> let hash : Digestif.SHA1.t = Digestif.SHA1.of_raw_string random_input in let hex = Digestif.SHA1.to_hex hash in Alcotest.(check sha1) "iso hex" (Digestif.SHA1.of_hex hex) hash let test_consistent_hex_iso i random_input = - Alcotest.test_case (strf "iso:%d" i) `Quick - @@ fun () -> + Alcotest.test_case (strf "iso:%d" i) `Quick @@ fun () -> let hash : Digestif.SHA1.t = Digestif.SHA1.of_raw_string random_input in let hex = Digestif.SHA1.to_hex hash in Alcotest.(check sha1) @@ -98,17 +97,21 @@ let test_consistent_hex_iso i random_input = let tests () = Alcotest.run "digestif" - [ "of_hex 0", List.mapi test_hex_success consistent_hex - ; "consistent_of_hex 0", List.mapi test_consistent_hex_success consistent_hex - ; "of_hex 1", List.mapi test_hex_success spaces_hex - ; "consistent_of_hex 1", List.mapi test_consistent_hex_success spaces_hex - ; "of_hex 2", List.mapi test_hex_success inconsistent_hex - ; "consistent_of_hex 2", List.mapi test_consistent_hex_fail inconsistent_hex - ; ( "iso of_hex" - , List.mapi test_hex_iso - (list_init (random_string Digestif.SHA1.digest_size) 64) ) - ; ( "iso consistent_of_hex" - , List.mapi test_consistent_hex_iso - (list_init (random_string Digestif.SHA1.digest_size) 64) ) ] + [ + ("of_hex 0", List.mapi test_hex_success consistent_hex); + ( "consistent_of_hex 0", + List.mapi test_consistent_hex_success consistent_hex ); + ("of_hex 1", List.mapi test_hex_success spaces_hex); + ("consistent_of_hex 1", List.mapi test_consistent_hex_success spaces_hex); + ("of_hex 2", List.mapi test_hex_success inconsistent_hex); + ( "consistent_of_hex 2", + List.mapi test_consistent_hex_fail inconsistent_hex ); + ( "iso of_hex", + List.mapi test_hex_iso + (list_init (random_string Digestif.SHA1.digest_size) 64) ); + ( "iso consistent_of_hex", + List.mapi test_consistent_hex_iso + (list_init (random_string Digestif.SHA1.digest_size) 64) ); + ] let () = tests () diff --git a/test/test.ml b/test/test.ml index e0f7b19..3173d13 100644 --- a/test/test.ml +++ b/test/test.ml @@ -3,14 +3,16 @@ let () = Printexc.record_backtrace true type _ s = Bytes : Bytes.t s | String : String.t s | Bigstring : bigstring s and bigstring = - (char, Bigarray_compat.int8_unsigned_elt, Bigarray_compat.c_layout) Bigarray_compat.Array1.t + ( char, + Bigarray_compat.int8_unsigned_elt, + Bigarray_compat.c_layout ) + Bigarray_compat.Array1.t -let title : type a k. [`HMAC | `Digest] -> k Digestif.hash -> a s -> string = +let title : type a k. [ `HMAC | `Digest ] -> k Digestif.hash -> a s -> string = fun computation hash input -> let pp_computation ppf = function | `HMAC -> Fmt.string ppf "hmac" - | `Digest -> Fmt.string ppf "digest" - in + | `Digest -> Fmt.string ppf "digest" in let pp_hash : type k. k Digestif.hash Fmt.t = fun ppf -> function | Digestif.MD5 -> Fmt.string ppf "md5" @@ -22,22 +24,22 @@ let title : type a k. [`HMAC | `Digest] -> k Digestif.hash -> a s -> string = | Digestif.SHA512 -> Fmt.string ppf "sha512" | Digestif.WHIRLPOOL -> Fmt.string ppf "whirlpool" | Digestif.BLAKE2B _ -> Fmt.string ppf "blake2b" - | Digestif.BLAKE2S _ -> Fmt.string ppf "blake2s" - in + | Digestif.BLAKE2S _ -> Fmt.string ppf "blake2s" in let pp_input : type a. a s Fmt.t = fun ppf -> function | Bytes -> Fmt.string ppf "bytes" | String -> Fmt.string ppf "string" - | Bigstring -> Fmt.string ppf "bigstring" - in + | Bigstring -> Fmt.string ppf "bigstring" in Fmt.strf "%a:%a:%a" pp_computation computation pp_hash hash pp_input input let bytes = Bytes + let string = String + let bigstring = Bigstring -let test_hmac : type k a. - a s -> k Digestif.hash -> a -> a -> k Digestif.t -> unit = +let test_hmac : + type k a. a s -> k Digestif.hash -> a -> a -> k Digestif.t -> unit = fun kind hash key input expect -> let title = title `HMAC hash kind in let test_hash = Alcotest.testable (Digestif.pp hash) (Digestif.equal hash) in @@ -68,34 +70,35 @@ let test_digest : type k a. a s -> k Digestif.hash -> a -> k Digestif.t -> unit let result = Digestif.digesti_bigstring hash (fun f -> f input) in Alcotest.(check test_hash) title expect result -let make_hmac : type a k. - name:string - -> a s - -> k Digestif.hash - -> a - -> a - -> k Digestif.t - -> unit Alcotest.test_case = +let make_hmac : + type a k. + name:string -> + a s -> + k Digestif.hash -> + a -> + a -> + k Digestif.t -> + unit Alcotest.test_case = fun ~name kind hash key input expect -> - name, `Slow, fun () -> test_hmac kind hash key input expect - -let make_digest : type a k. - name:string - -> a s - -> k Digestif.hash - -> a - -> k Digestif.t - -> unit Alcotest.test_case = + (name, `Slow, fun () -> test_hmac kind hash key input expect) + +let make_digest : + type a k. + name:string -> + a s -> + k Digestif.hash -> + a -> + k Digestif.t -> + unit Alcotest.test_case = fun ~name kind hash input expect -> - name, `Slow, fun () -> test_digest kind hash input expect + (name, `Slow, fun () -> test_digest kind hash input expect) let combine a b c = let rec aux r a b c = - match a, b, c with + match (a, b, c) with | xa :: ra, xb :: rb, xc :: rc -> aux ((xa, xb, xc) :: r) ra rb rc | [], [], [] -> List.rev r - | _ -> raise (Invalid_argument "combine") - in + | _ -> raise (Invalid_argument "combine") in aux [] a b c let makes ~name kind hash keys inputs expects = @@ -105,127 +108,154 @@ let makes ~name kind hash keys inputs expects = let to_bigstring s = let ln = Bytes.length s in - let bi = Bigarray_compat.Array1.create Bigarray_compat.Char Bigarray_compat.c_layout ln in + let bi = + Bigarray_compat.Array1.create Bigarray_compat.Char Bigarray_compat.c_layout + ln in for i = 0 to ln - 1 do - bi.{i} <- (Bytes.get s i) + bi.{i} <- Bytes.get s i done ; bi let split3 lst = let rec go (ax, ay, az) = function | (x, y, z) :: r -> go (x :: ax, y :: ay, z :: az) r - | [] -> List.rev ax, List.rev ay, List.rev az - in + | [] -> (List.rev ax, List.rev ay, List.rev az) in go ([], [], []) lst let keys_by, keys_st, keys_bi = - [ "Salut"; "Jefe"; "Lorenzo"; "Le son qui fait plaiz'" - ; "La c'est un peu chaud en vrai" ] + [ + "Salut"; + "Jefe"; + "Lorenzo"; + "Le son qui fait plaiz'"; + "La c'est un peu chaud en vrai"; + ] |> List.map (fun s -> - Bytes.unsafe_of_string s, s, to_bigstring (Bytes.unsafe_of_string s) - ) + (Bytes.unsafe_of_string s, s, to_bigstring (Bytes.unsafe_of_string s))) |> split3 let inputs_by, inputs_st, inputs_bi = - [ "Hi There"; "what do ya want for nothing?" - ; "C'est Lolo je bois de l'Ice Tea quand j'suis fonsde" - ; "Mes pecs dansent le flamenco, Lolo l'empereur du sale, dans le deal on \ - m'surnomme Joe La Crapule" - ; "Y'a un pack de douze a cote du cadavre dans le coffre. Pourquoi t'etais \ + [ + "Hi There"; + "what do ya want for nothing?"; + "C'est Lolo je bois de l'Ice Tea quand j'suis fonsde"; + "Mes pecs dansent le flamenco, Lolo l'empereur du sale, dans le deal on \ + m'surnomme Joe La Crapule"; + "Y'a un pack de douze a cote du cadavre dans le coffre. Pourquoi t'etais \ Charlie mais t'etais pas Jean-Pierre Coffe. Ca sniffe tellement la coke, \ mes crottes de nez c'est d'la MD. J'deteste juste les keufs, j'aime bien \ - les obeses et les pedes. Mamene finira dans le dico'. J'ai qu'un reuf: \ - le poto Rico. Ca rotte-ca l'argent des clodos. C'est moi qu'ecrit tous \ - les pornos. Cite-moi en controle de philo'. Toutes les miss grimpent aux \ - rideaux." ] + les obeses et les pedes. Mamene finira dans le dico'. J'ai qu'un reuf: le \ + poto Rico. Ca rotte-ca l'argent des clodos. C'est moi qu'ecrit tous les \ + pornos. Cite-moi en controle de philo'. Toutes les miss grimpent aux \ + rideaux."; + ] |> List.map (fun s -> - Bytes.unsafe_of_string s, s, to_bigstring (Bytes.unsafe_of_string s) - ) + (Bytes.unsafe_of_string s, s, to_bigstring (Bytes.unsafe_of_string s))) |> split3 let results_md5 = - [ "689e721d493b6eeea482947be736c808"; "750c783e6ab0b503eaa86e310a5db738" - ; "1cdd24eef6163afee7adc7c53dd6c9df"; "0316ebcad933675e84a81850e24d55b2" - ; "9ee938a2659d546ccc2e5993601964eb" ] + [ + "689e721d493b6eeea482947be736c808"; + "750c783e6ab0b503eaa86e310a5db738"; + "1cdd24eef6163afee7adc7c53dd6c9df"; + "0316ebcad933675e84a81850e24d55b2"; + "9ee938a2659d546ccc2e5993601964eb"; + ] |> List.map (Digestif.of_hex Digestif.md5) let results_sha1 = - [ "b0a6490a6fcb9479a7aa2306ecb56730d6225dba" - ; "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79" - ; "d80589525b1cc9f5e5ffd48ffd73d710ac89a3f1" - ; "0a5212b295e11a1de5c71873e70ce54f45119516" - ; "deaf6465e5945a0d04cba439c628ee9f47b95aef" ] + [ + "b0a6490a6fcb9479a7aa2306ecb56730d6225dba"; + "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"; + "d80589525b1cc9f5e5ffd48ffd73d710ac89a3f1"; + "0a5212b295e11a1de5c71873e70ce54f45119516"; + "deaf6465e5945a0d04cba439c628ee9f47b95aef"; + ] |> List.map (Digestif.of_hex Digestif.sha1) let results_sha224 = - [ "9a26f1380aae8c580441676891765c8a647ddf16a7d12fa427090901" - ; "a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44" - ; "b94a09654fc749ae6cb21c7765bf4938ff9af03e13d83fbf23342ce7" - ; "7c66e4c7297a22ca80e2e1db9774afea64b1e086be366d2da3e6bc83" - ; "438dc3311243cd54cc7ee24c9aac8528a1750abc595f06e68a331d2a" ] + [ + "9a26f1380aae8c580441676891765c8a647ddf16a7d12fa427090901"; + "a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44"; + "b94a09654fc749ae6cb21c7765bf4938ff9af03e13d83fbf23342ce7"; + "7c66e4c7297a22ca80e2e1db9774afea64b1e086be366d2da3e6bc83"; + "438dc3311243cd54cc7ee24c9aac8528a1750abc595f06e68a331d2a"; + ] |> List.map (Digestif.of_hex Digestif.sha224) let results_sha256 = - [ "2178f5f21b4311607bf9347bcde5f6552edb9ec5aa13b954d53de2fbfd8b75de" - ; "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843" - ; "aa36cd61caddefe26b07ba1d3d07ea978ed575c9d1f921837dff9f73e019713e" - ; "a7c8b53d68678a8e6e4d403c6b97cf0f82c4ef7b835c41039c0a73aa4d627d05" - ; "b2a83b628f7e0da71c3879b81075775072d0d35935c62cc6c5a79b337ccccca1" ] + [ + "2178f5f21b4311607bf9347bcde5f6552edb9ec5aa13b954d53de2fbfd8b75de"; + "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843"; + "aa36cd61caddefe26b07ba1d3d07ea978ed575c9d1f921837dff9f73e019713e"; + "a7c8b53d68678a8e6e4d403c6b97cf0f82c4ef7b835c41039c0a73aa4d627d05"; + "b2a83b628f7e0da71c3879b81075775072d0d35935c62cc6c5a79b337ccccca1"; + ] |> List.map (Digestif.of_hex Digestif.sha256) let results_sha384 = - [ "43e75797c1d875c5e5e7e90d0525061703d6b95b6137461566c2d067304458e62c144bbe12c0b741dcfaa38f7d41575e" - ; "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649" - ; "bd3b5c82edcd0f206aadff7aa89dbbc3a7655844ffc9f8f9fa17c90eb36b13ec7828fba7252c3f5d90cff666ea44d557" - ; "16461c2a44877c69fb38e4dce2edc822d68517917fc84d252de64132bd43c7cbe3310b7e8661741b7728000e8abf51e0" - ; "2c3751d1dc792344514928fad94672a256cf2f66344e4df96b0cc4cc3f6800aa5a628e9becf5f65672e1acf013284893" + [ + "43e75797c1d875c5e5e7e90d0525061703d6b95b6137461566c2d067304458e62c144bbe12c0b741dcfaa38f7d41575e"; + "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649"; + "bd3b5c82edcd0f206aadff7aa89dbbc3a7655844ffc9f8f9fa17c90eb36b13ec7828fba7252c3f5d90cff666ea44d557"; + "16461c2a44877c69fb38e4dce2edc822d68517917fc84d252de64132bd43c7cbe3310b7e8661741b7728000e8abf51e0"; + "2c3751d1dc792344514928fad94672a256cf2f66344e4df96b0cc4cc3f6800aa5a628e9becf5f65672e1acf013284893"; ] |> List.map (Digestif.of_hex Digestif.sha384) let results_sha512 = - [ "5f26752be4a1282646ed8c6a611d4c621e22e3fa96e9e6bc9e19a86deaacf0315151c46f779c3184632ab5793e2ddcb2ff87ca11cc886130f033364b08aef4e2" - ; "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" - ; "c2f2077f538171d7c6cbee0c94948f82987117a50229fb0b48a534e3c63553a9a9704cdb460c597c8b46b631e49c22a9d2d46bded40f8a77652f754ec725e351" - ; "89d7284e89642ec195f7a8ef098ef4e411fa3df17a07724cf13033bc6b7863968aad449cee973df9b92800d803ba3e14244231a86253cfacd1de882a542e945f" - ; "f6ecfca37d2abcff4b362f1919629e784c4b618af77e1061bb992c11d7f518716f5df5978b0a1455d68ceeb10ced9251306d2f26181407be76a219d48c36b592" + [ + "5f26752be4a1282646ed8c6a611d4c621e22e3fa96e9e6bc9e19a86deaacf0315151c46f779c3184632ab5793e2ddcb2ff87ca11cc886130f033364b08aef4e2"; + "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737"; + "c2f2077f538171d7c6cbee0c94948f82987117a50229fb0b48a534e3c63553a9a9704cdb460c597c8b46b631e49c22a9d2d46bded40f8a77652f754ec725e351"; + "89d7284e89642ec195f7a8ef098ef4e411fa3df17a07724cf13033bc6b7863968aad449cee973df9b92800d803ba3e14244231a86253cfacd1de882a542e945f"; + "f6ecfca37d2abcff4b362f1919629e784c4b618af77e1061bb992c11d7f518716f5df5978b0a1455d68ceeb10ced9251306d2f26181407be76a219d48c36b592"; ] |> List.map (Digestif.of_hex Digestif.sha512) let results_whirlpool = - [ "1174a4781245c2c78435b68bd0eb5e462f66a455ccfde94f61be594f9db841e7f4e85ba740f31dfd89186724f953cbd454451e987c608958dc9b563fd9594776" - ; "3d595ccd1d4f4cfd045af53ba7d5c8283fee6ded6eaf1269071b6b4ea64800056b5077c6a942cfa1221bd4e5aed791276e5dd46a407d2b8007163d3e7cd1de66" - ; "7af46cc6bb193d7958bd55a91509c99570cbd233d48a8fbf05207017040e27671024a21fad3877ecd2a309fc13c403ea8e83c6423ab8d695b654dbf6a1d2e8ee" - ; "a8646f7e371a1f9de1169d21de9a59ff2a32c73617c9b73708a226081b9316e81442e793e094c41a89e79705f1832c22e0cd3ac93d3b68a6842ddf35169908ae" - ; "b80dc14932e92fda0ba7f09e1db20d514633d15c2b89ad96a96198f4f751f2acf34e4fe0c9e2d13c4efaf7082c0871584b8dde7a367703d6fdf4f400a52f9432" ] + [ + "1174a4781245c2c78435b68bd0eb5e462f66a455ccfde94f61be594f9db841e7f4e85ba740f31dfd89186724f953cbd454451e987c608958dc9b563fd9594776"; + "3d595ccd1d4f4cfd045af53ba7d5c8283fee6ded6eaf1269071b6b4ea64800056b5077c6a942cfa1221bd4e5aed791276e5dd46a407d2b8007163d3e7cd1de66"; + "7af46cc6bb193d7958bd55a91509c99570cbd233d48a8fbf05207017040e27671024a21fad3877ecd2a309fc13c403ea8e83c6423ab8d695b654dbf6a1d2e8ee"; + "a8646f7e371a1f9de1169d21de9a59ff2a32c73617c9b73708a226081b9316e81442e793e094c41a89e79705f1832c22e0cd3ac93d3b68a6842ddf35169908ae"; + "b80dc14932e92fda0ba7f09e1db20d514633d15c2b89ad96a96198f4f751f2acf34e4fe0c9e2d13c4efaf7082c0871584b8dde7a367703d6fdf4f400a52f9432"; + ] |> List.map (Digestif.of_hex Digestif.whirlpool) let results_blake2b = - [ "aba2eef053923ba3a671b54244580ca7c8dfa9c487431c3437e1a8504e166ed894778045a5c6a314fadee110a5254f6f370e9db1d3093a62e0448a5e91b1d4c6" - ; "6ff884f8ddc2a6586b3c98a4cd6ebdf14ec10204b6710073eb5865ade37a2643b8807c1335d107ecdb9ffeaeb6828c4625ba172c66379efcd222c2de11727ab4" - ; "42aadab231ff4edbdad29a18262bbb6ba74cf0850f40b64a92dc62a92608a65f06af850aa1988cd1e379cf9cc9a8f64d61125d7b3def292ae57e537bc202e812" - ; "4abf562dc64f4062ea59ae9b4e2061a7a6c1a75af74b3663fd05aa4437420b8deea657e395a7dbac02aef7b7d70dc8b8a8db99aa8db028961a5ee66bac22b0f0" - ; "69f9e4236cd0c50204e4f8b86dc1751d37cc195835e9db25c9b366f41e1d86cdeec6a8702dfed1bc0ed0d6a1e2c5af275c331ec91f884c979021fb64021915de" + [ + "aba2eef053923ba3a671b54244580ca7c8dfa9c487431c3437e1a8504e166ed894778045a5c6a314fadee110a5254f6f370e9db1d3093a62e0448a5e91b1d4c6"; + "6ff884f8ddc2a6586b3c98a4cd6ebdf14ec10204b6710073eb5865ade37a2643b8807c1335d107ecdb9ffeaeb6828c4625ba172c66379efcd222c2de11727ab4"; + "42aadab231ff4edbdad29a18262bbb6ba74cf0850f40b64a92dc62a92608a65f06af850aa1988cd1e379cf9cc9a8f64d61125d7b3def292ae57e537bc202e812"; + "4abf562dc64f4062ea59ae9b4e2061a7a6c1a75af74b3663fd05aa4437420b8deea657e395a7dbac02aef7b7d70dc8b8a8db99aa8db028961a5ee66bac22b0f0"; + "69f9e4236cd0c50204e4f8b86dc1751d37cc195835e9db25c9b366f41e1d86cdeec6a8702dfed1bc0ed0d6a1e2c5af275c331ec91f884c979021fb64021915de"; ] |> List.map (Digestif.of_hex (Digestif.blake2b Digestif.BLAKE2B.digest_size)) let results_rmd160 = - [ "65b3cb3360881842a0d454bd6e7bc1bfe838b384" - ; "dda6c0213a485a9e24f4742064a7f033b43c4069" - ; "f071dcd2514fd89de78a5a2db1128dfa3e54d503" - ; "bda5511e63389385218a8d902a70f2d8dc4dc074" - ; "6c2486f169432281b6d71ae5b6765239c3cc1ea6" ] + [ + "65b3cb3360881842a0d454bd6e7bc1bfe838b384"; + "dda6c0213a485a9e24f4742064a7f033b43c4069"; + "f071dcd2514fd89de78a5a2db1128dfa3e54d503"; + "bda5511e63389385218a8d902a70f2d8dc4dc074"; + "6c2486f169432281b6d71ae5b6765239c3cc1ea6"; + ] |> List.map (Digestif.of_hex Digestif.rmd160) let results_blake2s = - [ "5bb23bbe41678b23e6d38881d2515fdf5df253dd2e9a80075ea759c93e1bca3a" - ; "90b6281e2f3038c9056af0b4a7e763cae6fe5d9eb4386a0ec95237890c104ff0" - ; "5d0064cb2848ab5dc948876a6be3e5685301a744735c25858c0bd283a7940eb7" - ; "6903efd2383b13adaa985d00ca271ccb420ab8f953841081c9c15a2dfebf866c" - ; "b8e167de23a5f136dc26bf06da0d724ebf7310903c2f702403b66810a230d622" ] + [ + "5bb23bbe41678b23e6d38881d2515fdf5df253dd2e9a80075ea759c93e1bca3a"; + "90b6281e2f3038c9056af0b4a7e763cae6fe5d9eb4386a0ec95237890c104ff0"; + "5d0064cb2848ab5dc948876a6be3e5685301a744735c25858c0bd283a7940eb7"; + "6903efd2383b13adaa985d00ca271ccb420ab8f953841081c9c15a2dfebf866c"; + "b8e167de23a5f136dc26bf06da0d724ebf7310903c2f702403b66810a230d622"; + ] |> List.map (Digestif.of_hex (Digestif.blake2s Digestif.BLAKE2S.digest_size)) module BLAKE2 = struct let input_blake2b_file = "../blake2b.test" + let input_blake2s_file = "../blake2s.test" let fold_s f a s = @@ -239,70 +269,70 @@ module BLAKE2 = struct | '0' .. '9' -> Char.code x - 48 | 'A' .. 'F' -> Char.code x - 55 | 'a' .. 'z' -> Char.code x - 87 - | _ -> raise (Invalid_argument "of_hex") - in + | _ -> raise (Invalid_argument "of_hex") in let wsp = function ' ' | '\t' | '\r' | '\n' -> true | _ -> false in fold_s - (fun (res, i, acc) -> function chr when wsp chr -> res, i, acc - | chr -> ( - match acc, code chr with - | None, x -> res, i, Some (x lsl 4) - | Some y, x -> - Bytes.set res i (Char.unsafe_chr (x lor y)) ; - res, succ i, None ) ) + (fun (res, i, acc) -> function chr when wsp chr -> (res, i, acc) + | chr -> + match (acc, code chr) with + | None, x -> (res, i, Some (x lsl 4)) + | Some y, x -> + Bytes.set res i (Char.unsafe_chr (x lor y)) ; + (res, succ i, None)) (Bytes.create len, 0, None) hex |> (function | _, _, Some _ -> invalid_arg "of_hex" | res, i, _ -> - if i = len then res + if i = len + then res else ( for i = i to len - 1 do Bytes.set res i '\000' done ; - res )) + res)) |> Bytes.unsafe_to_string let parse kind ic = ignore @@ input_line ic ; ignore @@ input_line ic ; let rec loop state acc = - match state, input_line ic with + match (state, input_line ic) with | `In, line -> let i = ref "" in Scanf.sscanf line "in:\t%s" (fun v -> - i := of_hex (String.length v / 2) v ) ; + i := of_hex (String.length v / 2) v) ; loop (`Key !i) acc | `Key i, line -> ( let k = ref None in Scanf.sscanf line "key:\t%s" (fun v -> - k := Some (Digestif.to_raw_string kind (Digestif.of_hex kind v)) - ) ; + k := Some (Digestif.to_raw_string kind (Digestif.of_hex kind v))) ; match !k with | Some k -> loop (`Hash (i, (k :> string))) acc - | None -> loop `In acc ) + | None -> loop `In acc) | `Hash (i, k), line -> ( let h = ref None in Scanf.sscanf line "hash:\t%s" (fun v -> - h := Some (Digestif.of_hex kind v) ) ; + h := Some (Digestif.of_hex kind v)) ; match !h with | Some h -> loop (`Res (i, k, h)) acc - | None -> loop `In acc ) + | None -> loop `In acc) | `Res v, "" -> loop `In (v :: acc) - | `Res v, _ -> (* avoid malformed line *) - loop (`Res v) acc - | exception End_of_file -> List.rev acc - in + | `Res v, _ -> + (* avoid malformed line *) + loop (`Res v) acc + | exception End_of_file -> List.rev acc in loop `In [] - let test_mac : type k a. - a s - -> k Digestif.hash - -> (module Digestif.MAC) - -> a - -> a - -> k Digestif.t - -> unit = + let test_mac : + type k a. + a s -> + k Digestif.hash -> + (module Digestif.MAC) -> + a -> + a -> + k Digestif.t -> + unit = fun kind hash (module Mac) key input expect -> let title = title `HMAC hash kind in let check (result : Mac.t) = @@ -312,15 +342,14 @@ module BLAKE2 = struct (Obj.magic result) (* XXX(dinosaure): ok, this is really bad but I'm lazy to keep type equality on [Mac] - extend interface and play with [with type t = t] - anywhere. *) - in + anywhere. *) in match kind with | Bytes -> check @@ Mac.maci_bytes ~key (fun f -> f input) | String -> check @@ Mac.maci_string ~key (fun f -> f input) | Bigstring -> check @@ Mac.maci_bigstring ~key (fun f -> f input) let make_keyed_blake m ~name kind hash key input expect = - name, `Slow, fun () -> test_mac kind hash m key input expect + (name, `Slow, fun () -> test_mac kind hash m key input expect) let tests m kind filename = let ic = open_in filename in @@ -328,7 +357,7 @@ module BLAKE2 = struct close_in ic ; List.map (fun (input, key, expect) -> - make_keyed_blake m ~name:"blake2{b,s}" string kind key input expect ) + make_keyed_blake m ~name:"blake2{b,s}" string kind key input expect) tests let tests_blake2s = @@ -346,58 +375,64 @@ end module RMD160 = struct let inputs = - [ ""; "a"; "abc"; "message digest"; "abcdefghijklmnopqrstuvwxyz" - ; "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - ; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" - ; "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + [ + ""; + "a"; + "abc"; + "message digest"; + "abcdefghijklmnopqrstuvwxyz"; + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; ] let expects = - [ "9c1185a5c5e9fc54612808977ee8f548b2258d31" - ; "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe" - ; "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc" - ; "5d0689ef49d2fae572b881b123a85ffa21595f36" - ; "f71c27109c692c1b56bbdceb5b9d2865b3708dbc" - ; "12a053384a9c0c88e405a06c27dcf49ada62eb2b" - ; "b0e20b6e3116640286ed3a87a5713079b21f5189" - ; "9b752e45573d4b39f4dbd3323cab82bf63326bfb" ] - - let million : expect:[`RMD160] Digestif.t -> unit Alcotest.test_case = + [ + "9c1185a5c5e9fc54612808977ee8f548b2258d31"; + "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe"; + "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"; + "5d0689ef49d2fae572b881b123a85ffa21595f36"; + "f71c27109c692c1b56bbdceb5b9d2865b3708dbc"; + "12a053384a9c0c88e405a06c27dcf49ada62eb2b"; + "b0e20b6e3116640286ed3a87a5713079b21f5189"; + "9b752e45573d4b39f4dbd3323cab82bf63326bfb"; + ] + + let million : expect:[ `RMD160 ] Digestif.t -> unit Alcotest.test_case = fun ~expect -> let iter n f = let rec go = function | 0 -> () | n -> f "a" ; - go (n - 1) - in - go n - in + go (n - 1) in + go n in let result = Digestif.digesti_string Digestif.rmd160 (iter 1_000_000) in let test_hash = - Alcotest.testable Digestif.(pp rmd160) Digestif.(equal rmd160) - in - ( "give me a million" - , `Slow - , fun () -> Alcotest.(check test_hash) "rmd160" expect result ) + Alcotest.testable Digestif.(pp rmd160) Digestif.(equal rmd160) in + ( "give me a million", + `Slow, + fun () -> Alcotest.(check test_hash) "rmd160" expect result ) let tests = let expect_million = - Digestif.of_hex Digestif.rmd160 - "52783243c1697bdbe16d37f97f68f08325dc1528" + Digestif.of_hex Digestif.rmd160 "52783243c1697bdbe16d37f97f68f08325dc1528" in List.map (fun (input, expect) -> - make_digest ~name:"rmd160" string Digestif.rmd160 input expect ) + make_digest ~name:"rmd160" string Digestif.rmd160 input expect) (List.combine inputs (List.map Digestif.(of_hex rmd160) expects)) - @ [million ~expect:expect_million] + @ [ million ~expect:expect_million ] end let str = Alcotest.testable (fun ppf -> Fmt.pf ppf "%S") String.equal let blake2s_spe digest_size = - Alcotest.test_case (Fmt.strf "BLAKE2S (digest-size: %d)" digest_size) `Quick @@ fun () -> - let module Hash = Digestif.Make_BLAKE2S(struct let digest_size = digest_size end) in + Alcotest.test_case (Fmt.strf "BLAKE2S (digest-size: %d)" digest_size) `Quick + @@ fun () -> + let module Hash = Digestif.Make_BLAKE2S (struct + let digest_size = digest_size + end) in Fmt.epr ">>> Use digest_string\n%!" ; let hash0 = Hash.digest_string "" in Fmt.epr ">>> Use feed_string\n%!" ; @@ -411,8 +446,11 @@ let blake2s_spe digest_size = Alcotest.(check str) "raw hash" raw_hash0 raw_hash1 let blake2b_spe digest_size = - Alcotest.test_case (Fmt.strf "BLAKE2B (digest-size: %d)" digest_size) `Quick @@ fun () -> - let module Hash = Digestif.Make_BLAKE2B(struct let digest_size = digest_size end) in + Alcotest.test_case (Fmt.strf "BLAKE2B (digest-size: %d)" digest_size) `Quick + @@ fun () -> + let module Hash = Digestif.Make_BLAKE2B (struct + let digest_size = digest_size + end) in let hash0 = Hash.digest_string "" in let hash1 = Hash.get (Hash.feed_string Hash.empty "") in let raw_hash0 = Hash.to_raw_string hash0 in @@ -425,75 +463,75 @@ let blake2b_spe digest_size = let tests () = Alcotest.run "digestif" - [ "md5", makes ~name:"md5" bytes Digestif.md5 keys_by inputs_by results_md5 - ; ( "md5 (bigstring)" - , makes ~name:"md5" bigstring Digestif.md5 keys_bi inputs_bi results_md5 - ) - ; ( "sha1" - , makes ~name:"sha1" bytes Digestif.sha1 keys_by inputs_by results_sha1 ) - ; ( "sha1 (bigstring)" - , makes ~name:"sha1" bigstring Digestif.sha1 keys_bi inputs_bi - results_sha1 ) - ; ( "sha224" - , makes ~name:"sha224" bytes Digestif.sha224 keys_by inputs_by - results_sha224 ) - ; ( "sha224 (bigstring)" - , makes ~name:"sha224" bigstring Digestif.sha224 keys_bi inputs_bi - results_sha224 ) - ; ( "sha256" - , makes ~name:"sha256" bytes Digestif.sha256 keys_by inputs_by - results_sha256 ) - ; ( "sha256 (bigstring)" - , makes ~name:"sha256" bigstring Digestif.sha256 keys_bi inputs_bi - results_sha256 ) - ; ( "sha384" - , makes ~name:"sha384" bytes Digestif.sha384 keys_by inputs_by - results_sha384 ) - ; ( "sha384 (bigstring)" - , makes ~name:"sha384" bigstring Digestif.sha384 keys_bi inputs_bi - results_sha384 ) - ; ( "sha512" - , makes ~name:"sha512" bytes Digestif.sha512 keys_by inputs_by - results_sha512 ) - ; ( "sha512 (bigstring)" - , makes ~name:"sha512" bigstring Digestif.sha512 keys_bi inputs_bi - results_sha512 ) - ; ( "whirlpool" - , makes ~name:"whirlpool" bytes Digestif.whirlpool keys_by inputs_by - results_whirlpool ) - ; ( "whirlpool (bigstring)" - , makes ~name:"whirlpool" bigstring Digestif.whirlpool keys_bi inputs_bi - results_whirlpool ) - ; ( "blake2b" - , makes ~name:"blake2b" bytes + [ + ("md5", makes ~name:"md5" bytes Digestif.md5 keys_by inputs_by results_md5); + ( "md5 (bigstring)", + makes ~name:"md5" bigstring Digestif.md5 keys_bi inputs_bi results_md5 + ); + ( "sha1", + makes ~name:"sha1" bytes Digestif.sha1 keys_by inputs_by results_sha1 ); + ( "sha1 (bigstring)", + makes ~name:"sha1" bigstring Digestif.sha1 keys_bi inputs_bi + results_sha1 ); + ( "sha224", + makes ~name:"sha224" bytes Digestif.sha224 keys_by inputs_by + results_sha224 ); + ( "sha224 (bigstring)", + makes ~name:"sha224" bigstring Digestif.sha224 keys_bi inputs_bi + results_sha224 ); + ( "sha256", + makes ~name:"sha256" bytes Digestif.sha256 keys_by inputs_by + results_sha256 ); + ( "sha256 (bigstring)", + makes ~name:"sha256" bigstring Digestif.sha256 keys_bi inputs_bi + results_sha256 ); + ( "sha384", + makes ~name:"sha384" bytes Digestif.sha384 keys_by inputs_by + results_sha384 ); + ( "sha384 (bigstring)", + makes ~name:"sha384" bigstring Digestif.sha384 keys_bi inputs_bi + results_sha384 ); + ( "sha512", + makes ~name:"sha512" bytes Digestif.sha512 keys_by inputs_by + results_sha512 ); + ( "sha512 (bigstring)", + makes ~name:"sha512" bigstring Digestif.sha512 keys_bi inputs_bi + results_sha512 ); + ( "whirlpool", + makes ~name:"whirlpool" bytes Digestif.whirlpool keys_by inputs_by + results_whirlpool ); + ( "whirlpool (bigstring)", + makes ~name:"whirlpool" bigstring Digestif.whirlpool keys_bi inputs_bi + results_whirlpool ); + ( "blake2b", + makes ~name:"blake2b" bytes Digestif.(blake2b BLAKE2B.digest_size) - keys_by inputs_by results_blake2b ) - ; ( "blake2b (bigstring)" - , makes ~name:"blake2b" bigstring + keys_by inputs_by results_blake2b ); + ( "blake2b (bigstring)", + makes ~name:"blake2b" bigstring Digestif.(blake2b BLAKE2B.digest_size) - keys_bi inputs_bi results_blake2b ) - ; ( "rmd160" - , makes ~name:"rmd160" bytes Digestif.rmd160 keys_by inputs_by - results_rmd160 ) - ; ( "rmd160 (bigstring)" - , makes ~name:"rmd160" bigstring Digestif.rmd160 keys_bi inputs_bi - results_rmd160 ) - ; ( "blake2s" - , makes ~name:"blake2s" bytes + keys_bi inputs_bi results_blake2b ); + ( "rmd160", + makes ~name:"rmd160" bytes Digestif.rmd160 keys_by inputs_by + results_rmd160 ); + ( "rmd160 (bigstring)", + makes ~name:"rmd160" bigstring Digestif.rmd160 keys_bi inputs_bi + results_rmd160 ); + ( "blake2s", + makes ~name:"blake2s" bytes Digestif.(blake2s BLAKE2S.digest_size) - keys_by inputs_by results_blake2s ) - ; ( "blake2s (bigstring)" - , makes ~name:"blake2s" bigstring + keys_by inputs_by results_blake2s ); + ( "blake2s (bigstring)", + makes ~name:"blake2s" bigstring Digestif.(blake2s BLAKE2S.digest_size) - keys_bi inputs_bi results_blake2s ) - ; "blake2s (keyed, input file)", BLAKE2.tests_blake2s - ; "blake2b (keyed, input file)", BLAKE2.tests_blake2b - ; "blake2s (specialization)", [ blake2s_spe 32 - ; blake2s_spe 8 - ; blake2s_spe 16 ] - ; "blake2b (specialization)", [ blake2b_spe 32 - ; blake2b_spe 64 - ; blake2b_spe 16 ] - ; "ripemd160", RMD160.tests ] + keys_bi inputs_bi results_blake2s ); + ("blake2s (keyed, input file)", BLAKE2.tests_blake2s); + ("blake2b (keyed, input file)", BLAKE2.tests_blake2b); + ( "blake2s (specialization)", + [ blake2s_spe 32; blake2s_spe 8; blake2s_spe 16 ] ); + ( "blake2b (specialization)", + [ blake2b_spe 32; blake2b_spe 64; blake2b_spe 16 ] ); + ("ripemd160", RMD160.tests); + ] let () = tests ()