# js-crypto-hash

> Universal Module for Hash Function in JavaScript

Latest version **1.0.7** (published 2023-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-crypto-hash
pnpm add js-crypto-hash
yarn add js-crypto-hash
bun add js-crypto-hash
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-09-27 |
| First published | 2018-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 81.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 162 |
| Author | Jun Kurihara |
| Maintainers | kurihara |
| Keywords | crypto, hash, webcrypto |

## Links

- npm: https://www.npmjs.com/package/js-crypto-hash
- Repository: https://github.com/junkurihara/jscu
- Homepage: https://github.com/junkurihara/jscu/tree/master/packages/js-crypto-hash#readme
- Issues: https://github.com/junkurihara/jscu/issues
- npm.io page: https://npm.io/package/js-crypto-hash

## Dependencies (5)

- [md5](https://npm.io/package/md5.md) ~2.3.0
- [sha3](https://npm.io/package/sha3.md) ~2.1.0
- [buffer](https://npm.io/package/buffer.md) ~6.0.0
- [hash.js](https://npm.io/package/hash.js.md) ~1.1.7
- [js-crypto-env](https://npm.io/package/js-crypto-env.md) ^1.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

- 1.0.7 (latest) — 2023-09-27
- 1.0.6 — 2023-09-02
- 1.0.5 — 2023-08-25
- 1.0.4 — 2022-02-04
- 1.0.3 — 2021-11-22
- 1.0.2 — 2021-03-13
- 1.0.1 — 2021-03-13
- 1.0.0 — 2020-09-30
- 0.6.3 — 2020-01-14
- 0.6.2 — 2019-12-08
- 0.6.1 — 2019-11-19
- 0.6.0 — 2019-11-19
- 0.5.2 — 2019-08-14
- 0.5.1 — 2019-07-13
- 0.5.0 — 2019-07-02
- … 21 more at https://npm.io/package/js-crypto-hash/versions

## README

Universal Module for Hash Function in JavaScript
--
[![npm version](https://badge.fury.io/js/js-crypto-hash.svg)](https://badge.fury.io/js/js-crypto-hash)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> **WARNING**: At this time this solution should be considered suitable for research and experimentation, further code and security review is needed before utilization in a production application.

# Introduction and Overview

This library is designed to 'universally' provide hash functions, i.e., it works both on most modern browsers and on Node.js just by importing from NPM/source code. Note that in the design principle, the library fully utilizes native APIs like WebCrypto API to accelerate its operation if available.

# Installation

At your project directory, do either one of the following.

- From npm/yarn:
  ```shell
  $ npm install --save js-crypto-hash // npm
  $ yarn add js-crypto-hash // yarn
  ```
- From GitHub:
  ```shell
  $ git clone https://github.com/junkurihara/jscu.git
  $ cd js-crypto-utils/packages/js-crypto-hash
  & yarn build
  ```

Then you should import the package as follows.

```shell
import hash from 'js-crypto-hash'; // for npm
import hash from 'path/to/js-crypto-hash/dist/index.js'; // for github
```

The bundled file is also given as `js-crypto-hash/dist/jschash.bundle.js` for a use case where the module is imported as a `window.jschash` object via `script` tags.

# Usage

## Compute hash value

```javascript
const msg = ...; // Uint8Array of arbitrary length
const algo = 'SHA-256';
hash.compute(msg, algo).then( (digest) => {
  // now you get a hash of msg in Uint8Array
});
```

# License
Licensed under the MIT license, see `LICENSE` file.

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