Hello,

[EMAIL PROTECTED] wrote on 06/02/2008 07:44:26 PM:

> I got a problem with openssl, I need to get the digest of the next line 
in UTF-8:
> 
> ||A|1|2005-09-02T16:30:00|1|ISP900909Q88|Industrias del Sur Poniente, 
S.A. de C.V.|
> Alvaro Obregón|37|3|Col. Roma Norte|México|Cuauhtémoc|Distrito 
Federal|México|06700|Pino
> Suarez|23|Centro|Monterrey|Monterrey|Nuevo 
Léon|México|95460|CAUR390312S87|Rosa María 
> Calderón Uriegas|Topochico|52|Jardines del 
Valle|Monterrey|Monterrey|Nuevo León|México|
> 95465|10|Caja|Vasos decorados|20|200|1|pieza|Charola 
metálica|150|150|IVA|52.5||
> 
> I save the string in a text file "string.txt" in notepad with UTF-8 
format, then I use 
> the next command:
> 
> openssl dgst -md5 string.txt
> 
> And I get the next result:
> 011bd54ffdcb0b3e97e4b9bbc69c5dd9
> 
> But according to a tutorial im following, the result should be:
> 8aa2b617944427353697e694a2e35a07
> 
> When I get the digest with .Net i get the correct result, but with 
openssl I don't, Can 
> someone tell me what is wrong?
This is end of line problem.
For example after saving your example to /tmp/zz.txt I get:

$ openssl md5 < /tmp/zz.txt
611af9d8272a34478514927b922f53b6

after reading this line to ZZ variable:

$ ZZ=`cat /tmp/zz.txt`
$ echo $ZZ | openssl md5
611af9d8272a34478514927b922f53b6

but when printing ZZ without new line:

$ echo -n $ZZ | openssl md5
8aa2b617944427353697e694a2e35a07

Best regards,
--
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to