Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Digest::Instance#base64digest

(?::string? str) -> ::String
base64digest(str = nil)

If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.

If a string is given, returns the hash value for the given string in a base64 encoded form, resetting the digest to the initial state before and after the process.

In either case, the return value is properly padded with ‘=’ and contains no line feeds.

See also #base64digest! #== #<< #block_length also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0