On Wed, 18 Feb 2009 04:40:22 +0100, xh <[email protected]> wrote:

BTW, I find another strange behaviour:
take the lines at the beginning of the file evptests.txt for example,
# SHA(1) tests (from shatest.c)
SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d

#echo 616263 > a.txt
SHA1(a.txt)= 765ecbbdc9e459fee019c275fbdd589d2948a009

As David Jacobson already pointed out, echo appends an unwanted newline. Furthermore, 616263 is hex encoding for abc:
echo -n 616263 | xxd -r -g 0 -p | xxd
0000000: 6162 63                                  abc

So, echo -n abc | openssl dgst -sha1 produces, as expected:
a9993e364706816aba3e25717850c26c9cd0d89d

HTH,
Kosta
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to