maroph icon

GPG2: create a hash value for a given file

maroph | PRO | 08/31/17 11:52:21 AM UTC | 0 ⭐ | 394 👁️ | Never ⏰ | []
text |

1.7 KB

|

None

|

0 👍

/

0 👎

First we let us show, which hash algorithms (message digests) are supported by our gpg2 version:
 $ gpg2 --version
gpg (GnuPG) 2.1.18
libgcrypt 1.7.6-beta
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 Home: /home/maro/develop/gpg2Test/gnupg_test
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
  My implementation in use support the hash algorithms SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224. So we can use this algorithms to create a hash for a given file:
 $ gpg2 --print-md sha1 test.txt
test.txt: 1387 009B EBC8 68B8 B51E  DCEF 64F6 33D6 BA1A 3500
 $ gpg2 --print-md ripemd160 test.txt
test.txt: 29D8 4D06 91AD FBFE 82D8  3EA5 5AD7 60A2 69D0 17B3
 $ gpg2 --print-md sha256 test.txt
test.txt: 177DD7CF 6C538F1C 7AD0C1B2 62C4EB5B 42C8E6C4 183507C9 526B3A74
          1EE80A00
 $ gpg2 --print-md sha384 test.txt
test.txt: 4518FC31 ABD330D3 262FD6ED 33FB4E44 ED605282 D8F22AB2 D956DD22
          4F89D261 D3ACBE99 F5A92763 812AF28A 8DE2D82A
 $ gpg2 --print-md sha512 test.txt
test.txt: 3828FBCC B63F899D 22A2E078 13B3B9B9 621663C5 AD5CFF3F D9DCBE35
          9362F12A 19A12A12 7B8538BF 70A3A940 9E714DB4 BA91C9E1 85B7A4EF
          5A6E07B3 1239499D
 $ gpg2 --print-md sha224 test.txt
test.txt: 149375C9 C49FC0DB C04BBA56 1F53114D 260E4FCC 16B0E8FE 9DB6074B

Comments