From: Wesley J Landaker Date: 2004-02-28T03:35:54+09:00 Subject: Re: Calculate the md5 hash of a string -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 27 February 2004 11:29 am, Dirk Einecke wrote: > Hi. > > How can I calculate the md5 hash of a string (like in PHP - > http://de2.php.net/manual/en/function.md5.php)? I can't find any > helpfull documentation about this problem. irb(main):001:0> require 'md5' => true irb(main):002:0> MD5.digest("test") => "\t\217k\315F!\323s\312\336N\203&'\264\366" irb(main):003:0> MD5.hexdigest("test") => "098f6bcd4621d373cade4e832627b4f6" irb(main):004:0> md5 = MD5.new => d41d8cd98f00b204e9800998ecf8427e irb(main):005:0> md5.update("te") => 569ef72642be0fadd711d6a468d68ee1 irb(main):006:0> md5 << "st" => 098f6bcd4621d373cade4e832627b4f6 - -- Wesley J. Landaker OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAP44G8KmKTEzW49IRAuXQAJ9A2cJlP792NzyFoZQmfrSxADo6JACfUSQs wZuJmemQeeQNmBZ4bHatFis= =12Hu -----END PGP SIGNATURE-----