Actually, the best thing is to simply use ripemd from the command line openssl:
a...@goldsmith:~$ echo -n "a" | openssl dgst -ripemd160 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe Or this can be done from within Sage by escaping to the command line. Alasdair On Apr 6, 12:50 am, William Stein <[email protected]> wrote: > On Mon, Apr 5, 2010 at 6:01 AM, Alasdair <[email protected]> wrote: > > I'm doing some experimentation with cryptographic hash functions, and > > I should be able to use openssl. I can load the python hashlib > > library: > > > sage: import hashlib > > sage: hashlib.<tab> > > hashlib.md5 hashlib.sha1 hashlib.sha256 hashlib.sha512 > > hashlib.new hashlib.sha224 hashlib.sha384 > > > Now, according to Python docs, hashlib.new should provide an interface > > to all functions in openssl > > (fromhttp://docs.python.org/library/hashlib.html): > > >>>> h = hashlib.new('ripemd160') > >>>> h.update("Nobody inspects the spammish repetition") > >>>> h.hexdigest() > > 'cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc' > > > However, I can't get ripemd on my system - and I'm pretty sure I have > > the full openssl installed (I'm running Ubuntu 9.10). > > > Does anybody know how I can get an interface to ripemd160 (and other > > hash functions)? > > I would make sure to install the openssl development packages, then > force a rebuild from source of Python in Sage. > > sage -f python-2.6.4.p7 > > where you should replace the version number by whatever is in > SAGE_ROOT/spkg/standard/. > > William > > -- > William Stein > Associate Professor of Mathematics > University of Washingtonhttp://wstein.org -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org To unsubscribe, reply using "remove me" as the subject.
