Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active March 9, 2026 13:11
Show Gist options
  • Select an option

  • Save sogaiu/0b75094eb94a7e640dc6f46978fa8777 to your computer and use it in GitHub Desktop.

Select an option

Save sogaiu/0b75094eb94a7e640dc6f46978fa8777 to your computer and use it in GitHub Desktop.
passphrase via terminal for gnupg
# create file
$ echo hello > fun.txt
# symmetric encryption
$ gpg --verbose --verbose --pinentry-mode loopback --symmetric fun.txt
gpg: enabled compatibility flags:
gpg: using cipher AES256.CFB
gpg: writing to 'fun.txt.gpg'
# decryption
$ gpg --verbose --verbose --pinentry-mode loopback --decrypt fun.txt.gpg
gpg: enabled compatibility flags:
# off=0 ctb=8c tag=3 hlen=2 plen=13
:symkey enc packet: version 4, cipher 9, aead 0, s2k 3, hash 10
salt 9A79F9F8B4821C30, count 65011712 (255)
gpg: AES256.CFB encrypted data
# off=15 ctb=d2 tag=18 hlen=2 plen=66 new-ctb
:encrypted data packet:
length: 66
mdc_method: 2
gpg: encrypted with 1 passphrase
gpg: public key encrypted data: good DEK
# off=36 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
:compressed packet: algo=1
# off=38 ctb=ac tag=11 hlen=2 plen=19
:literal data packet:
mode b (62), created 1773061811, name="fun.txt",
raw data: 6 bytes
gpg: original file name='fun.txt'
hello
gpg: decryption okay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment