Project

General

Profile

Actions

Feature #4262

closed

{key=>val}.hash is always equal to {val=>key}.hash

Added by phasis68 (Heesob Park) almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:34334]

Description

=begin
$ irb
irb(main):001:0> {1=>2}.hash
=> -381777873
irb(main):002:0> {2=>1}.hash
=> -381777873
irb(main):003:0> {123=>"abc"}.hash
=> 661749683
irb(main):004:0> {"abc"=>123}.hash
=> 661749683

This happens for Ruby 1.8.7 and 1.9.x.

It would be better to have different hash value for {key=>val} and {val=>key} .
=end

Actions

Also available in: Atom PDF

Like0
Like0