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

singleton method Digest::Base.base64digest

base64digest(str) -> StringRuby 3.0 から[permalink][rdoc][edit]

与えられた文字列に対するハッシュ値を、Base64 エンコードした文字列にして返します。 new(str).base64digest と等価です。

返す文字列は '=' でパディングされ、改行は含まれません。

require 'digest'
p Digest::MD5.base64digest('ruby') # => "WOU9EyTu9iZf25ewjtmq3w=="

[SEE_ALSO] Digest::Base#base64digest