crypto.lsp extention RIPEMD160

Started by newdep, March 26, 2009, 08:23:51 AM

Previous topic - Next topic

newdep

Hi Lutz,



I guess the RIPEMD160 can be added too to the crypto.lsp..

not that difficult to add (actualy the same as sha1 ;-) but ripemd160 is sometimes used instead of md5, just handy to have..



I only tested it on Win32 with GnuWin32 but i assume itll run unix too,

can check it later today..



I cant find the SHA256 inside the openssl lib actualy, did you had a look at

that perhpas?









(import library "RIPEMD160")
...
...
...


;; @syntax (crypto:ripemd160 <string> <bool-raw>)
;; @param <string> The string buffer for which to calculate a RIPEMD160 hash
;; @param <bool-raw> Return the raw binay buffer when 'true'.
;; @return The 20 Byte RIPEMD160 hash as a 40 Byte long hex string or as a 20 byte binary buffer.
;; @example
;; (crypto:ripemd160 "ABC") => "df62d400e51d3582d53c2d89cfeb6e10d32a3ca6"
;;
;; (crypto:ripemd160 (read-file "newlisp.exe")) => "9c1185a5c5e9fc54612808977ee8f548b2258d31"

(define (ripemd160 str raw-flag)
(if raw-flag
(let (buff (dup "00" 20))
(cpymem (RIPEMD160 str (length str) 0) buff 20)
buff)
(join
    (map (lambda (x) (format "%02x" (& x 0xff)))
(unpack (dup "c" 20) (RIPEMD160 str (length str) 0)))
)
)
)
-- (define? (Cornflakes))

newdep

#1
lets see if I can put Blowfish inside the crypto.lsp tonight..

Blowfish is fun ;-)
-- (define? (Cornflakes))

Lutz

#2
Thanks Norman, I will add this. There is so much more in libcrypto. But it is difficult for me to say, what else would be important to have in crypto.lsp.

kanen

#3
Anyone ever get Blowfish working in crypto?
. Kanen Flowers http://kanen.me[/url] .