From: lisp linux
Subject: ironclad sha1 versus linux sha1sum
Date: 
Message-ID: <AcudndgXOeyse0_anZ2dnUVZ_hSdnZ2d@comcast.com>
Hi

I tried a simple example from ironclad

(defun hash-string (string)
   (ironclad:byte-array-to-hex-string
    (ironclad:digest-sequence
     :sha1
     (ironclad:ascii-string-to-byte-array string))))

(Changed :sha256 to :sha1 as compared to the example at
http://www.cliki.net/Ironclad )

On repl

CL-USER> (hash-string "foobar")
"8843d7f92416211de9ebb963ff4ce28125932878"

Whereas
[······@localhost ~]$ echo foobar | sha1sum
988881adc9fc3655077dc2d4d757d480b5ea0e11  -

I think I also tried sha256 and md5. None of them matched with the output of the os utilities.
The CL stuff does match against itself between sbcl and clisp.

Why the difference ?
What do i need to do to match ?

For my purpose they need not match, but I'd like to find what causes the difference.
-Antony

From: Bruce Stephens
Subject: Re: ironclad sha1 versus linux sha1sum
Date: 
Message-ID: <87k5kdhved.fsf@cenderis.demon.co.uk>
lisp linux <·········@lisp.linux> writes:

[...]

> On repl
>
> CL-USER> (hash-string "foobar")
> "8843d7f92416211de9ebb963ff4ce28125932878"
>
> Whereas
> [······@localhost ~]$ echo foobar | sha1sum
> 988881adc9fc3655077dc2d4d757d480b5ea0e11  -
>
> I think I also tried sha256 and md5. None of them matched with the output of the os utilities.
> The CL stuff does match against itself between sbcl and clisp.
>
> Why the difference ?

The newline.

> What do i need to do to match ?

Use "echo -n".
From: lisp linux
Subject: Re: ironclad sha1 versus linux sha1sum
Date: 
Message-ID: <3KqdnaqHnu4NEUnanZ2dnUVZWhednZ2d@comcast.com>
Bruce Stephens wrote:
> 
> The newline.
> 
>> What do i need to do to match ?
> 
> Use "echo -n".

Thank you.

-Antony