maroph

GPG2: create a hash value for a given file

Aug 31st, 2017
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. First we let us show, which hash algorithms (message digests) are supported by our gpg2 version:
  2.  
  3. $ gpg2 --version
  4. gpg (GnuPG) 2.1.18
  5. libgcrypt 1.7.6-beta
  6. Copyright (C) 2017 Free Software Foundation, Inc.
  7. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
  8. This is free software: you are free to change and redistribute it.
  9. There is NO WARRANTY, to the extent permitted by law.
  10.  
  11. Home: /home/maro/develop/gpg2Test/gnupg_test
  12. Supported algorithms:
  13. Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
  14. Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
  15. CAMELLIA128, CAMELLIA192, CAMELLIA256
  16. Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
  17. Compression: Uncompressed, ZIP, ZLIB, BZIP2
  18.  
  19.  
  20. 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:
  21.  
  22. $ gpg2 --print-md sha1 test.txt
  23. test.txt: 1387 009B EBC8 68B8 B51E DCEF 64F6 33D6 BA1A 3500
  24.  
  25. $ gpg2 --print-md ripemd160 test.txt
  26. test.txt: 29D8 4D06 91AD FBFE 82D8 3EA5 5AD7 60A2 69D0 17B3
  27.  
  28. $ gpg2 --print-md sha256 test.txt
  29. test.txt: 177DD7CF 6C538F1C 7AD0C1B2 62C4EB5B 42C8E6C4 183507C9 526B3A74
  30. 1EE80A00
  31.  
  32. $ gpg2 --print-md sha384 test.txt
  33. test.txt: 4518FC31 ABD330D3 262FD6ED 33FB4E44 ED605282 D8F22AB2 D956DD22
  34. 4F89D261 D3ACBE99 F5A92763 812AF28A 8DE2D82A
  35.  
  36. $ gpg2 --print-md sha512 test.txt
  37. test.txt: 3828FBCC B63F899D 22A2E078 13B3B9B9 621663C5 AD5CFF3F D9DCBE35
  38. 9362F12A 19A12A12 7B8538BF 70A3A940 9E714DB4 BA91C9E1 85B7A4EF
  39. 5A6E07B3 1239499D
  40.  
  41. $ gpg2 --print-md sha224 test.txt
  42. test.txt: 149375C9 C49FC0DB C04BBA56 1F53114D 260E4FCC 16B0E8FE 9DB6074B
Advertisement
Add Comment
Please, Sign In to add comment