gnupg: discover hash algorithm used for signature

raw

gnupg-common-openpgpdefs.txt

...

typedef enum
  {
    DIGEST_ALGO_MD5         =  1,
    DIGEST_ALGO_SHA1        =  2,
    DIGEST_ALGO_RMD160      =  3,
    /* 4, 5, 6, and 7 are reserved. */
    DIGEST_ALGO_SHA256      =  8,
    DIGEST_ALGO_SHA384      =  9,
    DIGEST_ALGO_SHA512      = 10,
    DIGEST_ALGO_SHA224      = 11
  }
digest_algo_t;

...
raw

phork0.txt

$ echo foo | gpg --detach-sign --armor | LC_ALL=C gpg --list-packets --verbose

gpg: armor header: Version: GnuPG v1
:signature packet: algo 17, keyid 14C85A0824EAF823
	version 4, created 1440053810, md5len 0, sigclass 0x00
	digest algo 2, begin of digest 59 54
	hashed subpkt 2 len 4 (sig created 2015-08-20)
	subpkt 16 len 8 (issuer key ID 14C85A0824EAF823)
	data: [160 bits]
	data: [158 bits]
Christian Weiske Christian Weiske
owner

History