# js-multihash
[](http://ipn.io)
[](https://github.com/multiformats/multiformats)
[](https://webchat.freenode.net/?channels=%23ipfs)
[](https://codecov.io/gh/multiformats/js-multihash)
[](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
[Hugo Dias](http://github.com/hugomrdias/)
## Table of Contents
- [Install](#install)
- [Using npm](#using-npm)
- [Using a `
```
## Usage
```js
> var multihash = require('multihashes')
> var bytes = Uint8Array.from([0, 1, 2, 3...])
> var encoded = multihash.encode(bytes, 'sha1')
> console.log(encoded)
> multihash.decode(encoded)
{ code: 17,
name: 'sha1',
length: 20,
digest: }
```
## 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.