crypto module on ubuntu

Q&A's, tips, howto's
Locked
csfreebird
Posts: 107
Joined: Tue Jan 15, 2013 11:54 am
Location: China, Beijing
Contact:

crypto module on ubuntu

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

I execute the load statement in interaction environment:

Code: Select all

> (load "crypto.lsp")

ERR: user error : cannot find crypto library
That means I haven't libcrypto library installed. I installed it like so:

Code: Select all

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:

Code: Select all

> (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.
Last edited by csfreebird on Thu Jan 24, 2013 11:48 am, edited 1 time in total.

bairui
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

Re: crypto module on ubuntu

Post by bairui »

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

Code: Select all

apt-get install libssl0.9.8:i386
?

I am assuming the error message:

Code: Select all

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

csfreebird
Posts: 107
Joined: Tue Jan 15, 2013 11:54 am
Location: China, Beijing
Contact:

Re: crypto module on ubuntu

Post by csfreebird »

Thank you and you are right!
I found the correct file under /lib/x86_64-linux-gnu/ folder after installing the 64bit version:

Code: Select all

apt-get install libssl0.9.8
Then create a link for this:

Code: Select all

ln -s /lib/x86_64-linux-gnu/libcrypto.so.0.9.8 /usr/lib/
Now it works for me.

Code: Select all

> (load "crypto.lsp")
(lambda (crypto:str crypto:raw-flag) 
 (if crypto:raw-flag 
  (let (crypto:buff (dup "\000" 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
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

Re: crypto module on ubuntu

Post by bairui »

cool

Locked