On Sun, Jun 02, 2019 at 12:39:25PM +0200, Kristian Lein-Mathisen wrote:
> Hi guys,
> 
> I've come across a strange problem with simple-sha1. Sometimes it reports
> the wrong hash for large files when I use the sha1sum procedure. I don't
> know if the problem is there for strings.
> 
> 1216 klm@kth ~/archive  ➤ csi -R simple-sha1 -p '(sha1sum "MOV_0384.mp4")'
> ; sha1sum "MOV_0384.mp4"
> cb491b2f692dc3e9269a633f54eceb85269b0442
> 3b673158654ddc9bb668b5eafc050c8be66ad968
>  ./xz2/dcim/phone/100ANDRO/MOV_0384.mp4
> 
> >From not-very-rigorous testing, it seems it happens on all files that are
> bigger than the 512M mark:

This just screams "overflow"; (integer-length (* 512 1024 1024) => 30

Are you using CHICKEN 4 or CHICKEN 5?

Even CHICKEN 4 should deal with this correctly by overflowing into a
flonum.  That would be a bug in the egg, then.

Perhaps the fix is changing:
(define update (foreign-lambda void "SHA1Update" c-pointer c-pointer int))
into:
(define update (foreign-lambda void "SHA1Update" c-pointer c-pointer integer))

Can you try?

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to