# @accumulators/hashers

> A TypeScript implementation of multiple hashing functions

Latest version **4.3.0** (published 2026-04-02) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @accumulators/hashers
pnpm add @accumulators/hashers
yarn add @accumulators/hashers
bun add @accumulators/hashers
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2026-04-02 |
| First published | 2023-06-21 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 138.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Herodotus Dev Ltd |
| Maintainers | beeinger, 0xmarcello |

## Links

- npm: https://www.npmjs.com/package/@accumulators/hashers
- Repository: https://github.com/HerodotusDev/accumulators
- Issues: https://github.com/HerodotusDev/accumulators/issues
- npm.io page: https://npm.io/package/@accumulators/hashers

## Dependencies (6)

- [ethers](https://npm.io/package/ethers.md) 6.6.0
- [circomlibjs](https://npm.io/package/circomlibjs.md) ^0.1.7
- [micro-starknet](https://npm.io/package/micro-starknet.md) ^0.2.3
- [@accumulators/core](https://npm.io/package/@accumulators/core.md) ^4.2.3
- [@zkpassport/poseidon2](https://npm.io/package/@zkpassport/poseidon2.md) ^0.6.2
- [@ethersproject/solidity](https://npm.io/package/@ethersproject/solidity.md) ^5.7.0

## Recent versions

- 4.3.0 (latest) — 2026-04-02
- 4.2.3 — 2023-10-06
- 4.2.2 — 2023-09-20
- 4.2.1 — 2023-09-11
- 4.2.0-alpha.1 — 2023-09-11
- 4.2.0-alpha.0 — 2023-09-11
- 4.1.0-alpha.0 — 2023-09-11
- 4.0.1 — 2023-09-08
- 3.0.8 — 2023-08-28
- 3.0.3 — 2023-08-24
- 3.0.2 — 2023-08-24
- 3.0.1 — 2023-08-22
- 2.0.4 — 2023-08-22
- 2.0.3 — 2023-08-22
- 2.0.2 — 2023-07-27
- … 3 more at https://npm.io/package/@accumulators/hashers/versions

## README

# Hashers

`@accumulators/hashers` library implements the following hashing algorithms:

- Keccak
- Poseidon
- Poseidon2
- Stark Poseidon
- Stark Pedersen

## Example

```typescript
import { KeccakHasher } from "@accumulators/hashers";

const hasher = new KeccakHasher();

const hash = hasher.hash([`0x1234`, `0x5678`]);

console.log(hash);
```

## Functions

Every hasher supports the following functions:

#### `constructor(options: HasherOptions)` - creates a new hasher instance

Important: Don't use constructor for `PoseidonHasher`, use `async create()` function instead.

`HasherOptions` has the following interface:

```typescript
interface HasherOptions {
  blockSizeBits: number;
  shouldPad?: boolean;
}
```

- `blockSizeBits` (default is 256)
- `shouldPad` (defaults is `false`) - if `true` every outputted hash will have the same length and zeros will be padded at the beginning of the string

#### `hashSingle(data: string)`

Hashes a single string. Returns a hexadecimal number as a string (for example `0x1234567890abcdef`).

#### `hash(data: string[])`

Hashes array of string and returns a hexadecimal number as a string.

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