crypto.lsp extention RIPEMD160

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

crypto.lsp extention RIPEMD160

Post 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)))
		)
	)
)
Last edited by newdep on Thu Mar 26, 2009 4:13 pm, edited 1 time in total.
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

lets see if I can put Blowfish inside the crypto.lsp tonight..
Blowfish is fun ;-)
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

kanen
Posts: 145
Joined: Thu Mar 25, 2010 6:24 pm
Contact:

Re: crypto.lsp extention RIPEMD160

Post by kanen »

Anyone ever get Blowfish working in crypto?
. Kanen Flowers http://kanen.me .

Locked