# @dcl/hashing

> Hashing functions to calculate Decentraland Content Identifiers

Latest version **1.2.0** (published 2026-04-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @dcl/hashing
pnpm add @dcl/hashing
yarn add @dcl/hashing
bun add @dcl/hashing
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-04-27 |
| First published | 2022-02-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.0.0 |
| Dependencies | 5 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Decentraland |
| Maintainers | decentralandbot, imazzara |
| Keywords | decentraland, hashing, cid, ipfs |

## Links

- npm: https://www.npmjs.com/package/@dcl/hashing
- Repository: https://github.com/decentraland/core-libs
- Homepage: https://github.com/decentraland/core-libs#readme
- Issues: https://github.com/decentraland/core-libs/issues
- npm.io page: https://npm.io/package/@dcl/hashing

## Dependencies (5)

- [ipfs-unixfs](https://npm.io/package/ipfs-unixfs.md) ^12.0.2
- [@ipld/dag-pb](https://npm.io/package/@ipld/dag-pb.md) ^4.1.5
- [multiformats](https://npm.io/package/multiformats.md) ^13.4.2
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^1.8.0
- [ethereum-cryptography](https://npm.io/package/ethereum-cryptography.md) ^3.2.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2026-04-27
- 3.0.5-24901883478.commit-137b4e8 (next) — 2026-04-24
- 2.0.1-5658603228.commit-3682952 (ci) — 2023-07-25
- 3.0.5-11371204748.commit-66a894c — 2024-10-16
- 3.0.5-11370765960.commit-8d3e978 — 2024-10-16
- 3.0.5-6076037392.commit-98d7e38 — 2023-09-04
- 3.0.5-5870362096.commit-5b20172 — 2023-08-15
- 3.0.4 — 2023-08-02
- 3.0.4-5738948156.commit-a36c927 — 2023-08-02
- 3.0.3 — 2023-07-27
- 3.0.3-5682014246.commit-7b531d4 — 2023-07-27
- 3.0.2 — 2023-07-26
- 3.0.2-5673093742.commit-2c985cc — 2023-07-26
- 3.0.1 — 2023-07-25
- 3.0.1-5660305709.commit-f818da0 — 2023-07-25
- … 30 more at https://npm.io/package/@dcl/hashing/versions

## README

# @dcl/hashing

Hashing functions to calculate Decentraland Content Identifiers.

- `hashV1(arg): Promise<string>`: `ba` prefixed hashes are IPFSv1 hashes. Calculating hashes for files should generate the same result as an IPFS node.
- `hashV0(arg): Promise<string>`: `Qm` prefixed hashes are not IPFSv0 hashes, although they use the same encoding. This function is deprecated and kept for backwards compatibility.

```sh
npm i @dcl/hashing
```

```ts
import { hashV1 } from '@dcl/hashing'
import fs from 'node:fs'

const cidFromBuffer = await hashV1(fs.readFileSync('file'))
const cidFromStream = await hashV1(fs.createReadStream('file') as AsyncIterable<Uint8Array>)
```

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