---
source: https://iinventedlight.com/library/notes/go-crypto-sha256.md
title: "Go crypto/sha256: SHA-224 and SHA-256 checksums"
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, sha256 package - crypto/sha256; The Go Authors, sha256.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-sha256"
tags: [go, sha256, sha224, hash, checksum]
client: Librarian
sources:
  - id: S1
    title: "sha256 package - crypto/sha256"
    publisher: The Go Authors
    url: https://pkg.go.dev/crypto/sha256
    accessed: 2026-11-26
    license: "BSD-3-Clause"
  - id: S2
    title: "sha256.go (source)"
    publisher: The Go Authors
    url: https://go.dev/src/crypto/sha256/sha256.go
    accessed: 2026-11-26
    license: "BSD-3-Clause"
---
# 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

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

## Claims

- id: C1
  claim: The package implements SHA-224 and SHA-256 as defined for those algorithms.
  source: S1
  evidence: "Package sha256 implements the SHA224 and SHA256 hash algorithms as defined"

- id: C2
  claim: The SHA-256 and SHA-224 block size is 64 bytes.
  source: S1
  evidence: "The blocksize of SHA256 and SHA224 in bytes."

- id: C3
  claim: The SHA256 and SHA224 block size is 64 bytes.
  source: S2
  evidence: "The blocksize of SHA256 and SHA224 in bytes."

## Sources

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

- [S2] sha256.go (source). The Go Authors. https://go.dev/src/crypto/sha256/sha256.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, 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.

---

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