[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how calculate md4 hash?

dave

5/20/2005 7:44:00 PM



i would calculate an md4 hash in ruby.
i've found 'openssl' lib, but i have not any code sample.

:(


--
>here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.



2 Answers

WATANABE Hirofumi

5/23/2005 2:53:00 PM

0

Hi,

dave <dave.m@email.it> writes:

> i would calculate an md4 hash in ruby.
> i've found 'openssl' lib, but i have not any code sample.

% ruby -ropenssl -e 'puts OpenSSL::Digest::MD4.hexdigest("foo")'
0ac6700c491d70fb8650940b1ca1e4b2
% echo -n foo | openssl dgst -md4
0ac6700c491d70fb8650940b1ca1e4b2

--
eban


dave

5/23/2005 3:14:00 PM

0



> % ruby -ropenssl -e 'puts OpenSSL::Digest::MD4.hexdigest("foo")'
> 0ac6700c491d70fb8650940b1ca1e4b2

tnx.

i needed it to calculate ed2k links from console.

---
require 'openssl'

$*.each{|f|
puts "ed2k://|file|#{File.basename(f)}|#{File.size(f)}|
#{OpenSSL::Digest::MD4.hexdigest(File.read(f))}|"
}



--
>here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.