Skip to content

Commit

Permalink
Merge pull request #8 from mirage/fix
Browse files Browse the repository at this point in the history
Fixed #6
  • Loading branch information
dinosaure authored Jul 21, 2017
2 parents b4ef15b + 02a5402 commit 474db9b
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 351 deletions.
1 change: 1 addition & 0 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
true: safe_string, bin_annot

<common>: include
<src-c/digestif.{cma,cmxa}>: record_digestif_rakia_stubs
<src-c/digestif.cmxs>: link_digestif_rakia_stubs, use_bigarray
<src-ocaml/digestif.cmxs>: use_bigarray
2 changes: 1 addition & 1 deletion src-ocaml/baijiu_blake2b.ml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ module Make (B : Baijiu_buffer.S)

increment_counter ctx (Int64.of_int ctx.buflen);
set_lastblock ctx;
B.fill ctx.buf ctx.buflen (64 - ctx.buflen) '\x00';
B.fill ctx.buf ctx.buflen (128 - ctx.buflen) '\x00';
compress ctx ctx.buf 0;

for i = 0 to 7
Expand Down
7 changes: 5 additions & 2 deletions src-ocaml/baijiu_md5.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module Make (B : Baijiu_buffer.S)
let w = Array.make 16 0l in

for i = 0 to 15
do w.(i) <- B.le32_to_cpu buf (i * 4) done;
do w.(i) <- B.le32_to_cpu buf (off + (i * 4)) done;

let round f a b c d i k s =
let open Int32 in
Expand Down Expand Up @@ -178,9 +178,12 @@ module Make (B : Baijiu_buffer.S)
idx := 0;
end;

Format.printf "len: %d, off: %d, idx: %d.\n%!"
!len !off !idx;

while !len >= 64
do md5_do_chunk ctx buf !off;
len := !len - 64;
len := !len - 64;
off := !off + 64;
done;

Expand Down
2 changes: 1 addition & 1 deletion src-ocaml/baijiu_sha256.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module Make (B : Baijiu_buffer.S)
let w = Array.make 64 0l in

for i = 0 to 15
do w.(i) <- B.be32_to_cpu buf (i * 4) done;
do w.(i) <- B.be32_to_cpu buf (off + i * 4) done;

let ( -- ) a b = a - b in

Expand Down
2 changes: 1 addition & 1 deletion src-ocaml/baijiu_sha512.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module Make (B : Baijiu_buffer.S)
let w = Array.make 80 0L in

for i = 0 to 15
do w.(i) <- B.be64_to_cpu buf (i * 8) done;
do w.(i) <- B.be64_to_cpu buf (off + i * 8) done;

let ( -- ) a b = a - b in

Expand Down
Loading

0 comments on commit 474db9b

Please sign in to comment.