From: Yusuke ENDOH Date: 2011-04-16T21:39:26+09:00 Subject: [ruby-core:35784] Re: hashes are not consistent across ruby processes? Hello, IIRC, the behavior was changed with security in mind because a guessable hash value is a possible cause of Denial of Service attack. I think I've heard that such an attack had been done actually in Perl, but I have no pointer, so I could be wrong. 2011/4/16 Roger Pack : > Hello all. > I have a small program here that caches lookups. �To do so it writes > out a "unique" file based on the current ruby script, ex: > > filename = File.expand_path("~/#{$0.hash}") > > This worked great for looking up the file in 1.8.x, however in 1.9.x I > see the following behavior: > > c:\dev>irb >>> 'abc'.hash > => -753597542 >>> 'abc'.hash > => -753597542 # so it is consistent within the same process > > now run irb again: > > c:\dev>irb >>> 'abc'.hash > => 552773397 # different now! > > The hash values change each time you run a new process. �I would have > expected them to stay consistent so this is a bit surprising (even the > hash values for things like an empty array are different now, too, and > didn't used to be). > > Any feedback on this? > Thanks. > -r > > -- Yusuke Endoh