Skip to content
Calcrivo

SHA Hash Length Calculator

Get digest length, hex and Base64 output size, block size and collision resistance for any SHA-1, SHA-2 or SHA-3 variant.

Inputs

bytes

Digest Length

256bits

Hex String Length

64chars

Base64 Length

44chars

Block / Rate Size

64bytes

Collision Resistance

128bits

Compression Blocks Processed

17

Assessment

Strong — 128-bit collision resistance

Step by step

  1. Values used

    Hash algorithm = SHA-256; Message length = 1,024 bytes

  2. SHA Hash Length

    digest bytes = digest bits ÷ 8; hex chars = 2 × bytes; collision resistance = digest bits ÷ 2 (birthday bound); blocks = ⌈(message + padding) ÷ block size⌉.

  3. Keccak rate

    SHA-3 rate = 200 − 2 × (digest bytes), giving 136 bytes for SHA3-256 and 72 bytes for SHA3-512.

  4. Digest Length

    = 256 bits

  5. Hex String Length

    = 64 chars

  6. Base64 Length

    = 44 chars

  7. Block / Rate Size

    = 64 bytes

  8. Collision Resistance

    = 128 bits

  9. Compression Blocks Processed

    = 17

How it works

SHA-2 uses Merkle–Damgård padding: a 0x80 marker plus a 64-bit (SHA-224/256) or 128-bit (SHA-384/512) length field, padded to a whole block. SHA-3 is a sponge, so its absorbing rate shrinks as the digest grows, and collision resistance in both families is half the digest length because of the birthday bound. Column widths, HSM buffers and token size limits all depend on the exact hex or Base64 length, and picking a digest with under 128-bit collision resistance breaks any signature or dedup scheme built on it.

Formulas

SHA Hash Length

digest bytes = digest bits ÷ 8; hex chars = 2 × bytes; collision resistance = digest bits ÷ 2 (birthday bound); blocks = ⌈(message + padding) ÷ block size⌉.

digest bits
Output length fixed by the algorithm
block size
Bytes absorbed per compression (64 or 128 for SHA-2, the rate for SHA-3)
padding
1 marker byte plus an 8- or 16-byte length field for SHA-2

Keccak rate

SHA-3 rate = 200 − 2 × (digest bytes), giving 136 bytes for SHA3-256 and 72 bytes for SHA3-512.

Frequently Asked Questions

How is SHA Hash Length calculated?

digest bytes = digest bits ÷ 8; hex chars = 2 × bytes; collision resistance = digest bits ÷ 2 (birthday bound); blocks = ⌈(message + padding) ÷ block size⌉. SHA-2 uses Merkle–Damgård padding: a 0x80 marker plus a 64-bit (SHA-224/256) or 128-bit (SHA-384/512) length field, padded to a whole block. SHA-3 is a sponge, so its absorbing rate shrinks as the digest grows, and collision resistance in both families is half the digest length because of the birthday bound.

Why does SHA Hash Length matter?

Column widths, HSM buffers and token size limits all depend on the exact hex or Base64 length, and picking a digest with under 128-bit collision resistance breaks any signature or dedup scheme built on it.

What values do I need to enter?

This calculator takes 2 inputs: Hash algorithm, Message length. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

Why is SHA-512 sometimes faster than SHA-256?

SHA-512 works on 64-bit words and absorbs 128 bytes per block instead of 64, so on a 64-bit CPU without SHA-NI extensions it processes roughly 1.5× more bytes per second despite the larger digest.

You might also need