How to use GnuPG to generate sha512sum hash?

John Clizbe JPClizbe at tx.rr.com
Sat Sep 1 01:57:42 CEST 2007


Moses wrote:
> O...I see.
> I've get the correct hash on Linux..., thank you all! :-)
> 
> The problem remains now is how to get the same hashing on Windows,
> because echo on windows does not have -n flag:
>      > echo -n AAA
>      -n AAA
> so, on windows "echo -n AAA | gpg --print-md sha1" is actually hashing
> "-n AAA\n" but not "AAA"...   :-\
> 
> Is there a easy way to get rid of the newline on windows system?

A) Construct a text file containing your text without the CR-LF Windows likes
and use 'TYPE'


C:\WINDOWS\Temp>dir aaa.txt
 Volume in drive C is Ice Chest
 Volume Serial Number is 3083-4508

 Directory of C:\WINDOWS\Temp

2007-08-31  16:02                 3 aaa.txt
               1 File(s)              3 bytes
               0 Dir(s)  24,640,925,696 bytes free

C:\WINDOWS\Temp>type aaa.txt | gpg --print-md sha512
8D708D18 B54DF396 2D696F06 9AD42DAD 7762B5D4 D3C97EE5 FA2DAE06 73ED4654 5164C078
 B8DB3D59 C4B96020 E4316F17 BB3D91BF 1F6BC089 6BBE7541 6EB8C385

B) Or use any of the versions of bash or ksh available for Win32 to get a posix
environment. There are many available: MSYS, Cygwin, UWIN, SFU/Interix

C:\WINDOWS\Temp>bash
bash-3.2$ echo -n AAA | gpg --print-md sha512
8D708D18 B54DF396 2D696F06 9AD42DAD 7762B5D4 D3C97EE5 FA2DAE06 73ED4654 5164C078
 B8DB3D59 C4B96020 E4316F17 BB3D91BF 1F6BC089 6BBE7541 6EB8C385
bash-3.2$

-- 
John P. Clizbe                      Inet:   John (a) Mozilla-Enigmail.org
You can't spell fiasco without SCO. PGP/GPG KeyID: 0x608D2A10/0x18BB373A
"what's the key to success?"        / "two words: good decisions."
"what's the key to good decisions?" /  "one word: experience."
"how do i get experience?"          / "two words: bad decisions."

"Just how do the residents of Haiku, Hawai'i hold conversations?"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 663 bytes
Desc: OpenPGP digital signature
Url : /pipermail/attachments/20070831/0bdcc958/attachment.pgp 


More information about the Gnupg-users mailing list