How to use GnuPG to generate sha512sum hash?

John Cheetham john at johncheetham.com
Fri Sep 7 06:13:13 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$
> 

Alternatively you could use "echo.exe" which allows use of the "-n" flag
to get rid of the newline and is good for putting in scripts. It's in
UnxUtils which you can download from
http://sourceforge.net/projects/unxutils.






More information about the Gnupg-users mailing list