Fix indent

This commit is contained in:
Grégoire Henry 2018-02-20 18:29:37 +01:00
parent fa0175263f
commit a1b30417e2
3 changed files with 12 additions and 12 deletions

View File

@ -102,9 +102,9 @@ let pack l pack_len =
let rec inner (sub_acc_len, sub_acc, acc) = function let rec inner (sub_acc_len, sub_acc, acc) = function
| [] -> if sub_acc <> [] then List.rev sub_acc :: acc else acc | [] -> if sub_acc <> [] then List.rev sub_acc :: acc else acc
| h :: tl -> | h :: tl ->
if sub_acc_len = pack_len then if sub_acc_len = pack_len then
inner (1, [h], List.rev sub_acc :: acc) tl inner (1, [h], List.rev sub_acc :: acc) tl
else inner (succ sub_acc_len, h :: sub_acc, acc) tl else inner (succ sub_acc_len, h :: sub_acc, acc) tl
in in
List.rev (inner (0, [], []) l) List.rev (inner (0, [], []) l)

View File

@ -108,15 +108,15 @@ let vectors = [
let pp_diff ppf (l1, l2) = let pp_diff ppf (l1, l2) =
match List.length l1, List.length l2 with match List.length l1, List.length l2 with
| n, m when n <> m -> | n, m when n <> m ->
Format.fprintf ppf "Mnemonic size differs: %d vs %d" n m ; Format.fprintf ppf "Mnemonic size differs: %d vs %d" n m ;
| _ -> | _ ->
ignore @@ ListLabels.fold_left2 l1 l2 ~init:0 ~f:begin fun i w1 w2 -> ignore @@ ListLabels.fold_left2 l1 l2 ~init:0 ~f:begin fun i w1 w2 ->
if w1 <> w2 then begin if w1 <> w2 then begin
Format.fprintf ppf "At position %d, words differ: %s <> %s" Format.fprintf ppf "At position %d, words differ: %s <> %s"
i w1 w2 i w1 w2
end ; end ;
succ i succ i
end end
let vectors () = let vectors () =
ListLabels.iteri vectors ~f:begin fun i { entropy ; words ; seed } -> ListLabels.iteri vectors ~f:begin fun i { entropy ; words ; seed } ->

View File

@ -31,7 +31,7 @@ module Make (H: Hash.S) : S = struct
let rec f u xor = function let rec f u xor = function
0 -> xor 0 -> xor
| j -> let u = H.hmac ~key:password u in | j -> let u = H.hmac ~key:password u in
f u (Cs.xor xor u) (j - 1) f u (Cs.xor xor u) (j - 1)
in in
let int_i = Cstruct.create 4 in let int_i = Cstruct.create 4 in
Cstruct.BE.set_uint32 int_i 0 (Int32.of_int i); Cstruct.BE.set_uint32 int_i 0 (Int32.of_int i);