# hasch

> Simple and versatile hash function

Latest version **7.5.0** (published 2025-02-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install hasch
pnpm add hasch
yarn add hasch
bun add hasch
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.5.0 |
| Published | 2025-02-15 |
| First published | 2023-03-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Konrad Pettersson |
| Maintainers | konkenbonken |
| Keywords | hash, xxhash |

## Links

- npm: https://www.npmjs.com/package/hasch
- Repository: https://github.com/KonkenBonken/hasch
- Homepage: https://github.com/KonkenBonken/hasch#readme
- Issues: https://github.com/KonkenBonken/hasch/issues
- npm.io page: https://npm.io/package/hasch

## Dependencies (2)

- [xxh3-ts](https://npm.io/package/xxh3-ts.md) ^1.0.6
- [any-base](https://npm.io/package/any-base.md) ^1.1.0

## 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

- 7.5.0 (latest) — 2025-02-15
- 3.2.1 (v3-2-1) — 2024-09-24
- 7.4.3 — 2025-02-15
- 7.4.2 — 2025-01-30
- 7.4.1 — 2025-01-30
- 7.4.0 — 2025-01-30
- 7.3.1 — 2025-01-30
- 7.3.0 — 2025-01-30
- 7.2.2 — 2025-01-22
- 5.3.2 — 2025-01-22
- 6.4.2 — 2025-01-22
- 7.2.1 — 2025-01-22
- 7.2.0 — 2025-01-22
- 7.1.2 — 2025-01-22
- 7.1.1 — 2025-01-22
- … 45 more at https://npm.io/package/hasch/versions

## README

<h1 align="center">Welcome to hasch 👋</h1>
<p>
  <a href="https://www.npmjs.com/package/hasch" target="_blank">
    <img alt="Version" src="https://img.shields.io/npm/v/hasch.svg">
  </a>
  <a href="#" target="_blank">
    <img alt="License: ISC" src="https://img.shields.io/badge/License-ISC-yellow.svg" />
  </a>
</p>

## Install

```sh
npm i hasch
```

## Usage

```ts
import hasch from 'hasch'

  hasch(new Uint8Array(123))             === 329235993716377293806186649522918669518n
  hasch('abc')                           === 133147771053349843105193998924167742055n
  hasch(123)                             === 283825537867327248663696416593378114023n
  hasch(Buffer.alloc(5))                 === 49955116314016825874015941403329333188n
  hasch(true)                            === 150479606365948793785668837958725443536n
  hasch(123456n)                         === 130319799601172616329867553786126566458n
  hasch(new Date('2025-01-25'))          === 168775973375590997000841845937227583553n
  hasch(/abc/gi)                         === 234725142026940655262578860774808203504n
  hasch(new Error('abc'))                === 136767670103793469676517112123264489677n
  hasch(['abc', 123, false])             === 235420182704928267424669892444899362043n
  hasch(new Map([['a', 1]]))             === 2122105882539734952012980404045259426n
  hasch(new Set(['a', 1]))               === 201757903028860370997414747585367718303n
  hasch({ a: 1 })                        === 134240345615721032347562557264699527929n

  hasch('abc', { seed: 123 })            === 230655312275973925400513608974157726309n
  hasch('abc', { seed: 246 })            === 26379508875920428830785225613316203014n

  hasch('abc', { base: 8 })              === "1441265176316106065623406146045754755701147"
  hasch('abc', { base: 64 })             === "1AaRfPe8MROs6cMBZDJU9D"
  hasch('abc', { base: 64, length: 6 })  === "ZDJU9D"
  hasch('abc', { base: 64, seed: 1000 }) === "EEac4Z0v5fJXv+lnUVbBJ"
  hasch('abc', { base: '0oOöÖQ' })       === "QQöOQöÖoÖQÖÖÖ0ö0O00öoÖOOoQoo00oÖQöOÖ0öÖ0QoO0öÖQQQ"

  hasch('abc', { decimal: true })        === 0.3998924167742055
  hasch('abc', { choose: [2, 4, 'a'] })  === 4
```

## Author

👤 **Konrad Pettersson**

- Github: [`KonkenBonken`](https://github.com/KonkenBonken)
- LinkedIn: [`Konrad Pettersson`](https://linkedin.com/in/konrad-pettersson)
- Discord: `KonkenBonken`

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to create an [issue](https://github.com/KonkenBonken/hasch/issues) on GitHub.

<sub>_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_</sub>

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