# multihashes

> multihash implementation

Latest version **4.0.3** (published 2021-08-24) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2021-08-24 |
| First published | 2014-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 3 |
| Unpacked size | 69 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 122 |
| Maintainers | jacobheun, daviddias, achingbrain, hugomrdias |
| Keywords | multihash, multiformats, ipfs, hash |

## Links

- npm: https://www.npmjs.com/package/multihashes
- Repository: https://github.com/multiformats/js-multihash
- Issues: https://github.com/multiformats/js-multihash/issues
- npm.io page: https://npm.io/package/multihashes

## Dependencies (3)

- [varint](https://npm.io/package/varint.md) ^5.0.2
- [multibase](https://npm.io/package/multibase.md) ^4.0.1
- [uint8arrays](https://npm.io/package/uint8arrays.md) ^3.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.0.3 (latest) — 2021-08-24
- 3.1.3-next.2 (next) — 2021-02-16
- 4.0.2 — 2021-03-03
- 4.0.1 — 2021-03-01
- 4.0.0 — 2021-03-01
- 3.1.3-next.1 — 2021-02-16
- 3.1.3-next.0 — 2021-02-15
- 3.1.3-5 — 2021-02-13
- 3.1.3-4 — 2021-02-13
- 3.1.3-3 — 2021-02-13
- 3.1.3-1 — 2021-02-13
- 3.1.2 — 2021-01-26
- 3.1.1 — 2021-01-13
- 3.1.0 — 2020-11-24
- 3.0.1 — 2020-08-03
- … 36 more at https://npm.io/package/multihashes/versions

## README

# js-multihash <!-- omit in toc -->

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs)
[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multihash.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multihash)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/multiformats/js-multihash/ci?label=ci&style=flat-square)](https://github.com/multiformats/js-multihash/actions?query=branch%3Amaster+workflow%3Aci+)

> multihash implementation in node.js

This is the [multihash](//github.com/multiformats/multihash) implementation in Node.
It is extended by [js-multihashing](https://github.com/multiformats/js-multihashing)
and [js-multihashing-async](https://github.com/multiformats/js-multihashing-async),
so give those a look as well.

## Lead Maintainer <!-- omit in toc -->

[Hugo Dias](http://github.com/hugomrdias/)

## Table of Contents <!-- omit in toc -->

- [Install](#install)
  - [Using npm](#using-npm)
  - [Using a `<script>` tag](#using-a-script-tag)
- [Usage](#usage)
- [API](#api)
- [Update Constants](#update-constants)
- [Contribute](#contribute)
- [License](#license)

## Install

### Using npm

```bash
> npm install multihashes # NOTE: The name of the module is multihashes!
```

### Using a `<script>` tag

Loading this module through a script tag will make the `Multihashes` obj available in the global namespace.

```html
<script src="https://unpkg.com/multihashes/dist/index.min.js"></script>
```

## Usage

```js
> var multihash = require('multihashes')
> var bytes = Uint8Array.from([0, 1, 2, 3...])

> var encoded = multihash.encode(bytes, 'sha1')
> console.log(encoded)
<Uint8Array 11 14 0b ee c7 b5 ea 3f 0f db c9 5d 0d d4 7f 3c 5b c2 75 da 8a 33>

> multihash.decode(encoded)
{ code: 17,
  name: 'sha1',
  length: 20,
  digest: <Uint8Array 0b ee c7 b5 ea 3f 0f db c9 5d 0d d4 7f 3c 5b c2 75 da 8a 33> }
```

## API

https://multiformats.github.io/js-multihash/

## Update Constants

To update the constants table run the command below. This will fetch the main codec list from https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv and filter only the multihash codecs and update the `constants.js` file in this repo.

```sh
npm run update-constants
```


## Contribute

Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multihash/issues).

Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

[MIT](LICENSE) © Protocol Labs Inc.

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