Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

when I use this code to encrypt gpg.txt

gpg -c --cipher-algo AES256 --digest-algo SHA512 "GPG.txt"

I used this code to see if it encrypt with AES256 and SHA512

gpg --list-packets GPG.txt.gpg

symkey enc packet: version 4, cipher 9, s2k 3, hash 2

gpg: AES256 encrypted data

I found Cipher=9 witch is AES256 as I ask, But Hash=2 witch SHA1 not 10=SHA512 as I ask!

Why that happen, any one know how to force gpg to use SHA512 instead of SHA1

share|improve this question
1  
It seems like you are looking at the key packet. That's the part of the encrypted file that holds the actual encryption key. From the looks of it, the data itself isn't hashed at all (which makes sense, you are asking for symmetric encryption). Have you tried using asymmetric encryption instead and seeing if that makes any difference? –  Michael Kjörling Feb 6 '13 at 12:55
    
From the looks of it, the data itself isn't hashed at all (which makes sense, you are asking for symmetric encryption), what u mean? –  user195971 Feb 6 '13 at 13:14
    
Doesn't the hash make a difference only for signatures? –  vonbrand Feb 6 '13 at 18:12

1 Answer 1

up vote 2 down vote accepted

I hate to say it, but read the gpg man page.

The --digest-algo option chooses a message digest algorithm ... for the message ... i.e., if you create a signature.

The --s2k-digest-algo option sets what algo is used to hash the passphrases. If you set THAT to sha512, then you'll see hash 10 on that symkey enc packet line.

In response to your questions in the below comment:

  • Use --cipher-algo to specify the symmetric cipher algorithm used to actually encrypt the message.
  • Use --digest-algo to specify the digest algorithm used to hash the message when signing.
  • Use --s2k-digest-algo to specify the digest algorithm used for hashing passphrases in various operations (e.g., the symmetric passphrase specified when using -c).
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.