"Sebastian Ruhs" <RembrandtAkaDodger / gmx.de> writes:

> Could it be that the results of the MD5-Digest algorithm implemented in
> ruby are different from "md5sum"?
> If yes, why?
> If no, what did I wrong?
> 
> [code (ruby)]
> dodger@satan:~$ irb
> irb(main):001:0> require 'md5'
> true
> irb(main):002:0> MD5.md5('hello')
> 5d41402abc4b2a76b9719d911017c592
> 
> [shell]
> dodger@satan:~$ echo hello > hello
> dodger@satan:~$ md5sum hello
> b1946ac92492d2347c6235b4d2611184  hello

hrothgar ~ % echo hello | md5
b1946ac92492d2347c6235b4d2611184
hrothgar ~ % echo -n hello | md5 
5d41402abc4b2a76b9719d911017c592

The way you used 'echo' put a newline after "hello", hence the
different hash.

-- 
Steve Coltrin      spcoltri / omcl.org
  ALLERGEN INFORMATION: This post is packaged on shared equipment
  with peanuts and/or other nut meats.