# @casual-simulation/crypto

> Crypto helpers used by AUX

Latest version **4.0.5** (published 2026-01-30) · AGPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install @casual-simulation/crypto
pnpm add @casual-simulation/crypto
yarn add @casual-simulation/crypto
bun add @casual-simulation/crypto
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.5 |
| Published | 2026-01-30 |
| First published | 2019-04-25 |
| Weekly downloads | 0 |
| License | AGPL-3.0-only |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 85.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 61 |
| Author | Casual Simulation, Inc. |
| Maintainers | kallyngowdyyeti, casualsimulation |
| Keywords | cryptography, crypto |

## Links

- npm: https://www.npmjs.com/package/@casual-simulation/crypto
- Repository: https://github.com/casual-simulation/casualos
- Issues: https://github.com/casual-simulation/casualos/issues
- npm.io page: https://npm.io/package/@casual-simulation/crypto

## Dependencies (6)

- [hash.js](https://npm.io/package/hash.js.md) 1.1.7
- [base64-js](https://npm.io/package/base64-js.md) ^1.5.1
- [scrypt-js](https://npm.io/package/scrypt-js.md) 3.0.1
- [tweetnacl](https://npm.io/package/tweetnacl.md) 1.0.3
- [@types/scrypt-async](https://npm.io/package/@types/scrypt-async.md) ^1.3.1
- [@casual-simulation/fast-json-stable-stringify](https://npm.io/package/@casual-simulation/fast-json-stable-stringify.md) ^4.0.5

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 4.0.5 (latest) — 2026-01-30
- 4.0.1-alpha.21448844597 (alpha) — 2026-01-28
- 3.5.0-alpha.15494496163 (canary) — 2025-06-06
- 4.0.0 — 2026-01-27
- 3.10.4-alpha.20934784018 — 2026-01-12
- 3.10.3 — 2026-01-07
- 3.10.3-alpha.20787554310 — 2026-01-07
- 3.10.2 — 2026-01-06
- 3.5.0 — 2025-06-06
- 3.5.0-alpha.15427068700 — 2025-06-03
- 3.5.0-alpha.15425950413 — 2025-06-03
- 3.5.0-alpha.15119114602 — 2025-05-19
- 3.5.0-alpha.15117651144 — 2025-05-19
- 3.4.1-alpha.14318904853 — 2025-04-07
- 3.4.1-alpha.14316240392 — 2025-04-07
- … 86 more at https://npm.io/package/@casual-simulation/crypto/versions

## README

# Crypto

[![npm (scoped)](https://img.shields.io/npm/v/@casual-simulation/crypto.svg)](https://www.npmjs.com/package/@casual-simulation/crypto)

A common set of crypto helpers.

Defines a common interface for crypto implementations between web browsers and Node.js. (Currently only signing/verification and SHA-256 hashing is implemented)

## Installation

```
npm install @casual-simulation/crypto
```

## Usage

```js
// ES6-style imports are required.
// If you are running in an environment that does not support ES Modules,
// then use Webpack or Babel to transpile to the format you want. (like CommonJS)
import { getHash, parsePublicPEMKey } from '@casual-simulation/crypto';

let myHash = getHash('Hello, World');

console.log('Hash: ', myHash);
// Hash: 03675ac53ff9cd1535ccc7dfcdfa2c458c5218371f418dc136f2d19ac1fbe8a5

let publicKeyPEM = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAryQICCl6NZ5gDKrnSztO
3Hy8PEUcuyvg/ikC+VcIo2SFFSf18a3IMYldIugqqqZCs4/4uVW3sbdLs/6PfgdX
7O9D22ZiFWHPYA2k2N744MNiCD1UE+tJyllUhSblK48bn+v1oZHCM0nYQ2NqUkvS
j+hwUU3RiWl7x3D2s9wSdNt7XUtW05a/FXehsPSiJfKvHJJnGOX0BgTvkLnkAOTd
OrUZ/wK69Dzu4IvrN4vs9Nes8vbwPa/ddZEzGR0cQMt0JBkhk9kU/qwqUseP1QRJ
5I1jR4g8aYPL/ke9K35PxZWuDp3U0UPAZ3PjFAh+5T+fc7gzCs9dPzSHloruU+gl
FQIDAQAB
-----END PUBLIC KEY-----`;

let publicKeyBytes = parsePublicPEMKey(publicKeyPEM);
console.log(publicKeyBytes.byteLength);
```

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