End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Digest::SHA2#digest_length
digest_obj.digest_length → Integer
ext/digest/sha2/lib/sha2.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/ext/digest/sha2/lib/sha2.rb, line 130
def digest_length
@sha2.digest_length
end
Return the length of the hash value (the digest) in bytes.
Example
Digest::SHA256.new.digest_length * 8 # => 256 Digest::SHA384.new.digest_length * 8 # => 384 Digest::SHA512.new.digest_length * 8 # => 512
For example, digests produced by Digest::SHA256 will always be 32 bytes (256 bits) in size.