Ruby 4.1 リファレンスマニュアル

instance method String#hash

hash -> Integer[permalink][rdoc][edit]

self のハッシュ値を返します。 eql? で等しい文字列は、常にハッシュ値も等しくなります。

p "test".hash                      # => 4038258770210371295
p ("te" + "st").hash == "test".hash  # => true

[SEE_ALSO] Hash