# @chainsafe/as-sha256

> An AssemblyScript implementation of SHA256

Latest version **1.2.5** (published 2026-08-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @chainsafe/as-sha256
pnpm add @chainsafe/as-sha256
yarn add @chainsafe/as-sha256
bun add @chainsafe/as-sha256
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2026-08-18 |
| First published | 2019-09-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 61 |
| Author | ChainSafe Systems |
| Maintainers | wemeetagain, matthewkeil |

## Links

- npm: https://www.npmjs.com/package/@chainsafe/as-sha256
- Repository: https://github.com/ChainSafe/ssz
- Homepage: https://github.com/ChainSafe/ssz/tree/master/packages/as-sha256/#readme
- Issues: https://github.com/ChainSafe/ssz/issues
- npm.io page: https://npm.io/package/@chainsafe/as-sha256

## Recent versions

- 1.2.5 (latest) — 2026-08-18
- 1.2.4 — 2026-04-21
- 1.2.3 — 2026-04-21
- 1.2.0 — 2025-05-30
- 1.0.1 — 2025-03-13
- 1.1.0 — 2025-03-12
- 1.0.0 — 2025-01-23
- 0.6.1 — 2025-01-20
- 0.6.0 — 2025-01-16
- 0.5.0 — 2024-08-07
- 0.4.2 — 2024-05-06
- 0.4.1 — 2023-04-21
- 0.4.0 — 2023-04-05
- 0.3.1 — 2022-04-14
- 0.3.0 — 2022-03-24
- … 10 more at https://npm.io/package/@chainsafe/as-sha256/versions

## README

# as-sha256

![ES Version](https://img.shields.io/badge/ES-2015-yellow)
![Node Version](https://img.shields.io/badge/node-12.x-green)

AssemblyScript implementation of SHA256.

## Usage

`pnpm add @chainsafe/as-sha256`

```typescript
import {digest, digest64, SHA256} from "@chainsafe/as-sha256";

let hash: Uint8Array;

// create a new sha256 context
const sha256 = new SHA256();
// with init(), update(data), and final()
hash = sha256.init().update(Buffer.from("Hello world")).final();

// or use a one-pass interface
hash = digest(Buffer.from("Hello world"));

// or use a faster one-pass interface for hashing (only) 64 bytes
hash = digest64(Buffer.from("abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh"));
```

### License

Apache 2.0

---
_Source: https://npm.io/package/@chainsafe/as-sha256 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
