Option print-md: outputlines (with CR/LF) vary depending on pathlenght and hash-algo

el_infantil at tuta.io el_infantil at tuta.io
Wed Feb 1 14:29:11 CET 2017

Hello!I am using GnuPG (1.4.x) in a batch file to generate hash-sums of different files. 
[gpg.exe --homedir c:\path\ --print-md hashalgo c:\path\file >> output.txt]Depending on the path length to the file and the output length of the chosen hash-algorithm GnuPGs output is in one line, broken in the middle of the hash sum into two lines or the file-path and the hash-output are in two different lines (see below).This makes it different to catch the hash-output into a variable because it can not be predicted which kind of output comes. Can I make GnuPG to write its output to a single line without "CR/LF"? Then for /f and a : as delim could possibly work. But as for /f only reads one line at a time it can not handle GnuPGs current output.
E.G.:A short path and MD5 results in one line of output:c:\xyz.txt: B3 8E 8C 8E 8F C4 B2 D9  E9 80 CE 82 C2 F8 42 AA
A short path and SHA256 results in a linebreak within the hash-output: c:\xyz.txt: FBF0C442 98FC1E3B 9AFBF7A3 996FB924 24B3B4CE 649B1E49 A424291B         A952B855
A long path and SHA256 results in two different lines:
c:\X-Fold\Y-Fold\Z-Folg\ABCDEFG-PQRSTUV.TXT.TST: FA56B431 A5AB6BCE D4D385A3 B7414AFA DB11DFB1 853E6967 10128EBF 1412B3CD
Any idea how to solve this?
Thanks for help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20170201/bcce719e/attachment.html>

More information about the Gnupg-users mailing list