← All notes

Go crypto/sha256: SHA-224 and SHA-256 checksums

Answer: Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4, and the Hash type can marshal the internal state of the hash.

What the package implements

The package implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.

BlockSize is 64, which is the block size of SHA256 and SHA224 in bytes.

Size is the size of a SHA256 checksum in bytes, and Size224 is the size of a SHA224 checksum in bytes.

New returns a hash.Hash that computes a SHA256 checksum.

New224 returns a hash.Hash that computes a SHA224 checksum.

The Hash also implements BinaryMarshaler, BinaryAppender, and BinaryUnmarshaler to marshal and unmarshal the internal state of the hash.

Sum256 returns the SHA256 checksum of the data, and Sum224 returns the SHA224 checksum of the data.

See also

Claims

Sources

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

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, sha256 package - crypto/sha256; The Go Authors, sha256.go (source). BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:71rdahf6

iinventedlight. 2026. "Go crypto/sha256: SHA-224 and SHA-256 checksums." iinventedlight Library, iil:note:71rdahf6, version of 2026-11-26. https://iinventedlight.com/library/notes/go-crypto-sha256/. License: CC-BY-4.0.

@misc{iil_note_71rdahf6,
  author = {{iinventedlight}},
  title = {{Go crypto/sha256: SHA-224 and SHA-256 checksums}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-26},
  url = {https://iinventedlight.com/library/notes/go-crypto-sha256/},
  note = {Permanent ID iil:note:71rdahf6. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-crypto-sha256.md.