Page 1 of 1

crypto.lsp extention RIPEMD160

Posted: Thu Mar 26, 2009 3:23 pm
by 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?



Code: Select all

(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 "\000" 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)))
		)
	)
)

Posted: Thu Mar 26, 2009 3:37 pm
by newdep
lets see if I can put Blowfish inside the crypto.lsp tonight..
Blowfish is fun ;-)

Posted: Fri Mar 27, 2009 12:22 pm
by Lutz
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.

Re: crypto.lsp extention RIPEMD160

Posted: Wed Nov 14, 2012 11:36 pm
by kanen
Anyone ever get Blowfish working in crypto?