sha1 hash using libgcrypt different from what returns sha1sum

Denis Corbin libgcrypt at edrusb.is-a-geek.org
Wed Nov 13 16:45:33 CET 2013


On 13/11/2013 15:57, Daniel Kahn Gillmor wrote:
> On 11/13/2013 03:55 AM, Werner Koch wrote:
>> I wonder how we could do a regression test or get test vectors in the
>> first place.
> 
> If you don't mind burning a lot of CPU, it's pretty easy to generate a
> test vector from /dev/zero ("pee" is from the moreutils package, but
> similar results could easily be made from repeated pipelines):
> 
> 0 dkg at alice:~$ dd if=/dev/zero bs=1G count=257 | \
>   pee \
>   "openssl dgst -sha1 | cut -f2 -d' ' | sed s/$/:openssl/" \
>   "gpg --print-md SHA1 | tr -d ' ' | tr A-F a-f | sed s/$/:gpg/" \
>   "sha1sum | cut -f1 -d' ' | sed s/$/:binutils/"
> 257+0 records in
> 257+0 records out
> 275951648768 bytes (276 GB) copied, 1866.12 s, 148 MB/s
> 6938f23e29e7d3dcd100d0ed2df9d6593113718f:openssl
> 52416101a2ffd51e853aabbfb4e6fc67db066a32:gpg
> 6938f23e29e7d3dcd100d0ed2df9d6593113718f:binutils
> 0 dkg at alice:~$
> 

If you need, you can also use/adapt the test software I've used to
reproduce the problem, there is no copyright on it :)

Denis Corbin.



More information about the Gnupg-devel mailing list