crypto module on ubuntu

Started by csfreebird, January 23, 2013, 11:31:43 PM

Previous topic - Next topic

csfreebird

Hello I try to use md5 function on ubuntu12.10 amd64 version.

After downloading the crypto.lsp file from below:

http://www.newlisp.org/code/modules/crypto.lsp.html">http://www.newlisp.org/code/modules/crypto.lsp.html



I execute the load statement in interaction environment:

> (load "crypto.lsp")

ERR: user error : cannot find crypto library


That means I haven't libcrypto library installed. I installed it like so:

apt-get install libssl0.9.8:i386
ln -s /lib/i386-linux-gnu/libcrypto.so.0.9.8 /usr/lib/


Then got another error message here:



> (load "crypto.lsp")

ERR: problem loading library in function import : "/usr/lib/libcrypto.so.0.9.8: wrong ELF class: ELFCLASS32"


Have no idea about this now.

bairui

#1
just a stab in the dark here, csfreebird, but you said you were on amd64 but then went and installed:


apt-get install libssl0.9.8:i386

?



I am assuming the error message:


wrong ELF class: ELFCLASS32

is saying that it expected a 64-bit ELF class...

csfreebird

#2
Thank you and you are right!

I found the correct file under /lib/x86_64-linux-gnu/ folder after installing the 64bit version:

apt-get install libssl0.9.8


Then create a link for this:

ln -s /lib/x86_64-linux-gnu/libcrypto.so.0.9.8 /usr/lib/


Now it works for me.

> (load "crypto.lsp")
(lambda (crypto:str crypto:raw-flag)
 (if crypto:raw-flag
  (let (crypto:buff (dup "00" 20))
   (cpymem (crypto:RIPEMD160 crypto:str (length crypto:str) 0) crypto:buff 20) crypto:buff)
  (join (map (lambda (crypto:x) (format "%02x" (& crypto:x 255))) (unpack (dup "c"
      20)
     (crypto:RIPEMD160 crypto:str (length crypto:str) 0))))))
> (crypto:md5 "ABC")
"902fbdd2b1df0c4f70b4a5d23525e932"

bairui

#3
cool