---
source: https://iinventedlight.com/library/notes/go-crypto-aes.md
title: "Go crypto/aes: AES block cipher as defined in FIPS 197"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Go Authors, aes package - crypto/aes; The Go Authors, aes.go (source). BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-crypto-aes"
tags: [go, aes, rijndael, cipher, fips-197]
client: Librarian
sources:
  - id: S1
    title: "aes package - crypto/aes"
    publisher: The Go Authors
    url: https://pkg.go.dev/crypto/aes
    accessed: 2026-11-26
    license: "BSD-3-Clause"
  - id: S2
    title: "aes.go (source)"
    publisher: The Go Authors
    url: https://go.dev/src/crypto/aes/aes.go
    accessed: 2026-11-26
    license: "BSD-3-Clause"
---
# Go crypto/aes: AES block cipher as defined in FIPS 197
**Answer:** The aes package implements AES encryption, formerly Rijndael, as defined in US Federal Information Processing Standards Publication 197.

## Algorithm and key sizes

The package implements AES encryption, formerly Rijndael, as defined in that publication.

The block size is 16 bytes.

NewCipher creates and returns a new cipher Block.

Give NewCipher a 16, 24, or 32 byte key, which selects AES 128, AES 192, or AES 256.

KeySizeError reports an invalid key size.

## Constant-time behavior

AES operations here are not implemented with constant-time algorithms.

Hardware support can make the operations constant-time, including AES NI on amd64 and Message Security Assist on s390x.

On those systems, passing NewCipher's result into cipher NewGCM also keeps GCM GHASH constant-time.

## See also

- [go-cipher](https://iinventedlight.com/library/notes/go-cipher/)
- [go-crypto-rand](https://iinventedlight.com/library/notes/go-crypto-rand/)
- [go-tls](https://iinventedlight.com/library/notes/go-tls/)

## Claims

- id: C1
  claim: The package implements AES as defined in FIPS 197.
  source: S1
  evidence: "Package aes implements AES encryption (formerly Rijndael), as defined in"

- id: C2
  claim: NewCipher accepts a 16-, 24-, or 32-byte key for AES-128, AES-192, or AES-256.
  source: S1
  evidence: "either 16, 24, or 32 bytes to select"

- id: C3
  claim: NewCipher accepts a 16-, 24-, or 32-byte key for AES 128, AES 192, or AES 256.
  source: S2
  evidence: "either 16, 24, or 32 bytes to select"

## Sources

- [S1] aes package - crypto/aes. The Go Authors. https://pkg.go.dev/crypto/aes . License: BSD-3-Clause. Accessed 2026-11-26.

- [S2] aes.go (source). The Go Authors. https://go.dev/src/crypto/aes/aes.go . License: BSD-3-Clause. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, aes package - crypto/aes; The Go Authors, aes.go (source). BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
