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
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".