Symmetric key lengths and hash output sizes

Key, nonce, tag and digest lengths for common AEAD ciphers and SHA hash functions, with units and the RFC section each figure comes from.

On this page

Symmetric key size and hash output size at a glance

If you are sizing buffers, configuration fields or key files for symmetric encryption, the most-used figures are these. AEAD_AES_128_GCM uses a 16-octet key, a 12-octet nonce and a 16-octet authentication tag, and AEAD_AES_256_GCM uses a 32-octet key with the same nonce and tag lengths (RFC 5116, Sections 5.1 and 5.2). AEAD_CHACHA20_POLY1305 uses a 256-bit (32-octet) key, a 96-bit (12-octet) nonce and a 128-bit (16-octet) tag (RFC 8439, Section 2.8). For hashing, SHA-256 produces a 256-bit digest and uses 512-bit (64-octet) message blocks (RFC 6234, Sections 1 and 8.1.1).

This table is for engineers configuring TLS, SSH, IPsec or storage encryption who need to confirm the length of a key, nonce or tag before writing a parameter, allocating a buffer or checking a key file. Note that the key length is not the same as the strength of the key: SSH guidance says all ciphers SHOULD use keys with an effective key length of 128 bits or more (RFC 4253, Section 6.3), so confirm the effective length for the cipher you select rather than assuming it from the nominal size.

The sibling tables cover RSA modulus and key sizes, elliptic-curve key and point sizes, finite-field Diffie-Hellman group sizes and SSH key sizes by key type. Those tables are where to look for asymmetric key lengths, because the figures on this page apply only to symmetric keys, nonces, tags and hash digests. Confirm each length against the RFC for the exact algorithm and version your product implements before you size a fixed field.

AEAD and SHA key, nonce, tag and digest lengths in octets and bits

This table lists key, nonce, tag and digest lengths for common AEAD ciphers and SHA hash functions, with message block sizes where RFCs give them. Read each row against the RFC named in the source column, since lengths are given in octets for AEAD and in bits for SHA. Use these figures as the symmetric baseline when sizing buffers and reviewing post-quantum readiness of key material.

AlgorithmKey lengthNonce lengthTag lengthDigest lengthMessage block lengthSource section
AEAD_AES_128_GCM16 octets12 octets16 octetsNot applicableNot applicableRFC 5116, Section 5.1
AEAD_AES_256_GCM32 octets12 octets16 octetsNot applicableNot applicableRFC 5116, Section 5.2
AEAD_AES_128_CCM16 octets12 octets16 octetsNot applicableNot applicableRFC 5116, Section 5.3
ChaCha20256 bits96 bitsNot applicableNot applicableNot applicableRFC 8439, Section 2.3
Poly130532 bytes (one-time key)Not applicable16 bytesNot applicableNot applicableRFC 8439, Section 2.5
AEAD_CHACHA20_POLY1305256 bits (32 octets)96 bits (12 octets)128 bits (16 octets)Not applicableNot applicableRFC 8439, Section 2.8
SHA-1Not applicableNot applicableNot applicable160 bits512 bits (64 octets)RFC 6234, Sections 1, 4 and 8.1.1
SHA-224Not applicableNot applicableNot applicable224 bits512 bits (64 octets)RFC 6234, Sections 1, 4 and 8.1.1
SHA-256Not applicableNot applicableNot applicable256 bits512 bits (64 octets)RFC 6234, Sections 1, 4 and 8.1.1
SHA-384Not applicableNot applicableNot applicable384 bits1024 bits (128 octets)RFC 6234, Sections 1, 4 and 8.1.1
SHA-512Not applicableNot applicableNot applicable512 bits1024 bits (128 octets)RFC 6234, Sections 1, 4 and 8.1.1

How to read the symmetric key and digest columns

The key and digest columns on this page give lengths in two units, and you need to read each one correctly before comparing rows. Key sizes for the AEAD ciphers are given in octets (8-bit bytes), as RFC 5116 does, while ChaCha20 and its companion Poly1305 are often described in bits. Digest lengths for the SHA family are given in bits in RFC 6234, with the octet equivalent in parentheses where the RFC supplies it. A 256-bit key is the same as a 32-octet key, so AEAD_AES_256_GCM and AEAD_CHACHA20_POLY1305 share a key length even though their rows look different. Check the unit in each column header before you size a buffer, since mixing octets and bits by a factor of eight is an easy mistake in configuration files and code.

The nonce and tag columns matter only for AEAD (authenticated encryption with associated data) rows, and they describe different things. The nonce is the per-message value that must not repeat under the same key, and the tag is the authentication value appended to the ciphertext. For AEAD_AES_128_GCM and AEAD_AES_256_GCM, RFC 5116 gives the nonce bounds as N_MIN and N_MAX, both 12 octets, and these are the only nonce bounds the sources on this page give for AES-GCM. For ChaCha20, RFC 8439 Section 2.3 describes the state as a 256-bit key, a 96-bit nonce and a 32-bit block counter. That 32-bit counter is why ChaCha20 alone lists a counter column: it sets how many 64-byte blocks one nonce can cover, so it is a limit you should confirm in your own implementation rather than assume.

Where a 16-octet tag and a 12-octet nonce affect the design

The tag and nonce lengths in AEAD ciphers set limits on how messages are authenticated, how many can be sent under one key, and how much each packet carries. The cards below cover the places where these sizes change design decisions, based on what the sources say.

Nonce uniqueness per key

AES-GCM and AES-CCM as specified in RFC 5116 use a 12-octet nonce, and ChaCha20-Poly1305 in RFC 8439 uses a 96-bit nonce. The nonce must never repeat under the same key, because reuse can expose plaintext and break authentication. Check that your protocol derives nonces from a counter or a sequence number, and that the key is rotated before the counter or the random space could be exhausted. A repeated nonce under one key is the failure to design against.

RFC 5116 text

Tag size and packet overhead

Each AEAD ciphertext carries a 16-octet authentication tag alongside the encrypted payload, and RFC 5116 gives this length for AES-GCM and AES-CCM. For short messages, the tag is a large share of the bytes on the wire. Add the tag, plus any nonce or header field your protocol transmits, to the payload size when calculating packet and buffer limits.

SSH key effective length guidance

RFC 4253 Section 6.3 states that all SSH ciphers SHOULD use keys with an effective key length of 128 bits or more. The 16-octet AES-128 key meets that guidance, and the 32-octet AES-256 key exceeds it. When you audit SSH configurations, confirm that the negotiated ciphers meet this minimum and that any cipher offered to clients is not weaker than it.

RFC 4253 text

Hash message block sizes

SHA-1, SHA-224 and SHA-256 process 64-octet message blocks, and SHA-384 and SHA-512 process 128-octet blocks, according to RFC 6234. Code that buffers input or pads messages must size its buffers to these block lengths. Mismatched buffer sizes can cause incorrect digests or wasted memory, so confirm the block size your library uses before writing fixed-size buffers.

RFC 6234 text

Fixed-size fields in protocol parsers

Because the key, nonce and tag lengths are fixed for each cipher, parsers can read those fields at known offsets. A parser that assumes the wrong length for a given cipher will misread the packet, so the cipher identifier must be checked before the fields are read. Test parsers against the exact octet counts listed in RFC 5116 and RFC 8439 for each supported cipher.

AES-GCM, AES-CCM, ChaCha20-Poly1305 and SHA-2 figures by option

AES-GCM is defined for use as an AEAD (authenticated encryption with associated data) construction in RFC 5116, where each AEAD algorithm is given its own key, nonce and tag lengths. The RFC defines two AES-GCM options that differ only in key size, so the nonce and tag fields are the same for both.

  • AEAD_AES_128_GCM (RFC 5116, Section 5.1): uses a 16-octet key, a 12-octet nonce (N_MIN and N_MAX are both 12) and a 16-octet authentication tag.
  • AEAD_AES_256_GCM (RFC 5116, Section 5.2): is identical to the 128-bit option except that the key is 32 octets.
  • Fixed nonce length: the 12-octet nonce is fixed for both options, so nonce fields in protocol messages and storage schemas should allocate exactly 12 octets.
  • Tag length: the 16-octet tag is the same for both key sizes, so ciphertext overhead per record is unchanged when moving from the 128-bit to the 256-bit option.

Confirm the key length, nonce length and tag length your protocol or library uses against RFC 5116, since the RFC defines the AEAD interface and the sizes your implementation exposes may be configured separately.

How to confirm the cipher and digest sizes in your deployment

This sequence checks that the cipher, key, nonce, tag and digest sizes your systems use match the values in this reference, so that buffers and parsers are sized correctly before traffic moves to a new configuration. Each step ends with a check you can record.

  1. Identify the AEAD cipher in each protocol configuration

    Review the TLS, SSH, IPsec and application configuration files on each system and record every AEAD cipher suite that is enabled, such as AES-GCM, AES-CCM or ChaCha20-Poly1305. Include the cipher names exactly as the configuration writes them, since these names map to the sizes listed in this table. Your inventory is complete when every enabled AEAD cipher on each system appears in one list with the protocol and file where it was found.

  2. Identify the hash functions and digest lengths in use

    In the same configuration files, record each hash function named for HMAC, key derivation, signatures or integrity checks, such as SHA-1, SHA-256, SHA-384 or SHA-512. Note where each hash appears, because digest length and message block size both matter for buffer sizing. Your list is complete when every hash function in the configuration has a row showing its protocol and location.

  3. Check key and nonce lengths against the table

    For each cipher on your list, look up the key length and nonce length in this reference and compare them with the values in the vendor or library documentation for the version you run. For example, AES-128-GCM uses a 16-octet key and a 12-octet nonce, while AES-256-GCM uses a 32-octet key with the same nonce size. Record any mismatch between this table and the documentation, and treat it as an open item until the vendor confirms the correct value.

  4. Confirm the authentication tag length your parser allocates

    Check the authentication tag length that your parser, record layer or application code reserves for each AEAD cipher. The sources in this reference list a 16-octet tag for AES-GCM, AES-CCM and ChaCha20-Poly1305. Verify in the code or library source that the allocated buffer is at least this size, and confirm that truncated tags are either not used or are explicitly handled. Your check is complete when each cipher's tag size is recorded and matched to a buffer.

  5. Test a round trip with exact key and nonce sizes

    In a test environment, encrypt and decrypt a sample message with each cipher using keys and nonces of exactly the lengths you confirmed in the previous steps. Verify that the decrypted output matches the input and that the tag verifies. Run the same test against any non-standard key or nonce size your code produces, so that a size error shows up in testing rather than in production. The step is done when every cipher on your list passes the round trip.

  6. Ask your vendors to confirm sizes for your version

    Send each library or appliance vendor the list of ciphers, key lengths, nonce lengths and tag lengths you recorded, and ask them to confirm these values for the exact version and edition you run. Request written confirmation, and note any version-specific differences. Do not assume that a value applies to a different release, because sizes and defaults can change between versions. The step is complete when each vendor has returned written confirmation or a documented difference that you have recorded.

What these symmetric and hash sizes do not tell you

The lengths in this table are defined in the RFCs listed on this page. They tell you how many octets a key, nonce or tag occupies on the wire or in an API, and how large a digest or message block is. They do not measure how fast an algorithm runs, how much memory it uses, or how much security margin it provides. Do not read a longer key or digest as a faster or stronger configuration without checking those separately. Performance is covered on its own reference pages, and the sources listed here do not establish a security strength rating for each cipher, so do not map these lengths to a bit-security level unless a source you have confirmed does so.

Key length also needs care. SSH, as defined in RFC 4253, says all ciphers SHOULD use keys with an effective key length of 128 bits or more. The effective key length SSH refers to is not always the same as the nominal key length written in a cipher's name or in the table above, so an audit of an SSH server should check the cipher's effective key length against that guidance rather than assuming the nominal figure applies. Confirm which ciphers your SSH implementation offers and how it negotiates them.

Finally, the values here describe the RFC definitions only. Libraries, operating systems and protocol versions may implement a cipher or hash with different parameters, support only some of the listed options, or change defaults between releases. Before you size buffers, configure a protocol or write a compliance statement, confirm the key, nonce, tag and digest lengths against the documentation for the exact library and version you run, and treat that documentation as the authority for your environment.

Common questions about symmetric key and hash output sizes

How many bytes is an AES-256-GCM key?

An AES-256-GCM key is 32 octets (32 bytes, or 256 bits). AEAD_AES_256_GCM is identical to AEAD_AES_128_GCM except for the key length, which is 32 octets instead of 16 (RFC 5116, Section 5.2). The key length is the only size that changes between the two variants. The nonce stays at 12 octets and the authentication tag stays at 16 octets. When you size a key store, a configuration field or a buffer for AES-256-GCM, allocate 32 bytes for the key itself and confirm with your library's documentation that it expects a raw 32-byte key rather than a hex or base64 encoding of it, since encoded forms are longer than the raw key.

What nonce length does AES-GCM use?

AES-GCM uses a 12-octet (96-bit) nonce. Both AEAD_AES_128_GCM and AEAD_AES_256_GCM define N_MIN and N_MAX as 12 octets, so a nonce of 12 bytes is the length to supply to the cipher (RFC 5116, Section 5.1). The same 12-octet nonce length applies to AEAD_AES_128_CCM (RFC 5116, Section 5.3). The nonce must never be reused under the same key. Nonce management is a design decision for your application and library, so confirm with the documentation of the library you run how it generates and tracks nonces before you deploy.

How long is a SHA-256 digest in bytes?

A SHA-256 digest is 256 bits, which is 32 bytes. RFC 6234 gives the digest sizes for the SHA family: SHA-1 has a 160-bit digest, SHA-224 has 224 bits, SHA-256 has 256 bits, SHA-384 has 384 bits and SHA-512 has 512 bits (RFC 6234, Sections 1 and 8.1.1). SHA-256 processes messages in 512-bit (64-byte) blocks (RFC 6234, Sections 4 and 8.1.1). When you store a digest, remember that a hex-encoded SHA-256 value is 64 characters long while the raw value is 32 bytes, so check which form your storage field and protocol field expect.

What is the tag length of ChaCha20-Poly1305?

The authentication tag for AEAD_CHACHA20_POLY1305 is 128 bits, which is 16 octets (RFC 8439, Section 2.8). The construction uses a 256-bit (32-octet) key and a 96-bit (12-octet) nonce. The underlying Poly1305 primitive produces a 16-byte tag from a 32-byte one-time key (RFC 8439, Section 2.5). Those Poly1305 values are the primitive's own sizes. The AEAD tag you see on the wire or in a record is the 16-octet value defined for the AEAD construction. If you are sizing packet or record buffers, add 16 octets of tag to each protected payload.

Does SSH require 128-bit keys?

SSH does not mandate a specific key length, but RFC 4253 says that all ciphers SHOULD use keys with an effective key length of 128 bits or more (RFC 4253, Section 6.3). SHOULD is a recommendation, so a deployment that uses shorter effective keys is not following the guidance, and the guidance does not force a particular cipher. Check which ciphers your SSH server and client actually negotiate, and confirm the effective key length each one provides in its own documentation before you rely on it. The key sizes for SSH host and user key files are covered on a separate page in this reference.

What block size does SHA-512 use for messages?

SHA-512 processes messages in 1024-bit (128-byte) blocks. SHA-384 uses the same 1024-bit block size, while SHA-1, SHA-224 and SHA-256 use 512-bit (64-byte) blocks (RFC 6234, Sections 4 and 8.1.1). The block size matters when you size a hashing buffer or when you tune a streaming implementation to process data in whole blocks. The digest length of SHA-512 is 512 bits (64 bytes), as listed in RFC 6234. Confirm the buffer sizing and streaming behavior with the documentation of the library you use, because implementations differ in how they expose block handling.

Is a 256-bit key the same size as a 256-bit digest?

Yes, the key and the digest are both 256 bits (32 bytes) in these examples, but they are different kinds of values and should not be treated as interchangeable. A key is a secret used to encrypt or authenticate, while a digest is the output of a hash function over some input. The matching length does not mean one can stand in for the other. The AES-256 key and the SHA-256 digest each have their own role in a system. Keep their handling, storage and rotation separate, and confirm the intended use of each value in the design document for your system.

Where the key, nonce and tag travel in an AEAD record

The diagram starts with the plaintext, the 16-octet key and the 12-octet nonce entering the AEAD seal operation, which is the point where the cipher is applied. The seal step produces the ciphertext and a 16-octet authentication tag, and both leave together as the record body. The nonce is not drawn as part of the ciphertext in this example, so the reader must send it separately or derive it from the record context, and the 12-octet length applies to AEAD_AES_128_GCM and AEAD_AES_256_GCM alike. Check that each hand-off matches the RFC 5116 sizes for the exact AEAD you run, since a different algorithm may use a different key or tag length. This example is illustrative only.

Illustrative flow of key, nonce and plaintext into an AEAD seal operation.

How DeployOpen helps teams check cipher and key sizes in their systems

DeployOpen helps teams confirm which cipher key, nonce, tag and digest lengths their systems actually use, and compare them against the values defined in the relevant RFCs. We work inside your own infrastructure, so the review covers the configurations your services run, not a generic checklist.

How we scope

  • We agree in writing which systems, protocols and cipher suites fall inside the review.
  • The scope lists which RFC definitions (for example RFC 5116 and RFC 8439) the findings will be measured against.
  • Engagements are fixed-scope, and ongoing support is available as a retainer after the review.

How we build

  • We inventory the AES-GCM, AES-CCM and ChaCha20-Poly1305 configurations in use and record their key and nonce lengths.
  • We check hash usage against the SHA-1, SHA-2 digest sizes and message block sizes in RFC 6234.
  • We confirm SSH cipher key lengths against the 128-bit minimum guidance in RFC 4253, Section 6.3.

How we hand over

  • You receive a written findings report listing each system, cipher suite and the length observed.
  • Each finding notes the source section it was compared against, so your reviewers can verify it.
  • We provide the configuration changes needed, and you confirm compatibility for the versions you run.

How we support

  • We retest the agreed systems after your configuration changes are applied.
  • Retainers cover upgrades and continuous review when your cipher and hash settings change over time.
  • Your compliance and security teams keep the documentation for their own assessments, which we prepare but do not certify.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.