Project

General

Profile

Feature #4262

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

Added by Heesob Park over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[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

History

#1 Updated by Nobuyoshi Nakada over 5 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r30514.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF