Skip to content

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#block_length

digest_obj.block_length → Integer

Return the block length of the digest in bytes.

Example
Digest::SHA256.new.block_length * 8
# => 512
Digest::SHA384.new.block_length * 8
# => 1024
Digest::SHA512.new.block_length * 8
# => 1024
See also #<< #digest_length .new #reset also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0