sha1 hash using libgcrypt different from what returns sha1sum

Daniel Kahn Gillmor dkg at
Wed Nov 13 15:57:54 CET 2013

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
0 dkg at alice:~$


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1027 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20131113/989546df/attachment.sig>

More information about the Gnupg-devel mailing list