Project

General

Profile

Actions

Bug #4104

closed

String#hash should return different value for different string.

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

Status:
Closed
Assignee:
-
Target version:
ruby -v:
Backport:
[ruby-core:33500]

Description

=begin
On Ruby 1.9.x, String#hash returns same value for any "\x00" trailing string.

C:\work>irb
irb(main):001:0> "a".hash
=> -242103097
irb(main):002:0> "a\x00".hash
=> -242103097
irb(main):003:0> "a\x00\x00".hash
=> -242103097

On Ruby 1.8.6, String#hash returns different value for different string.

C:\work>irb
irb(main):001:0> "a".hash
=> 100
irb(main):002:0> "a\x00".hash
=> 6561949
irb(main):003:0> "a\x00\x00".hash
=> 826408672

I think that String#hash should return different value for different string.
=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

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

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

=end

Actions

Also available in: Atom PDF

Like0
Like0