A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://multiformats.github.io/js-multihashing-async/ below:

multihashing-async - v2.1.3

⛔️ DEPRECATED: This module has been superseded by the multiformats module

js-multihashing-async

Use all the functions in multihash.

Lead Maintainer

Hugo Dias

Notice

This module is moving to async/await starting from 0.7.0. The last minor version to support callbacks is 0.6.0, any backports will merged to the branch callbacks and released under >0.6.0 <0.7.0.

Wait, why, how is this different from Node crypto?

This module just makes working with multihashes a bit nicer. js-multihash is only for encoding/decoding multihashes, and does not depend on other libs. This module will depend on various implementations for each hash. It currently uses crypto and sha3 in Node.js. In the browser webcrypto and browserify-sha3 are used.

Table of Contents Install In Node.js through npm
$ npm install --save multihashing-async
const multihashing = require('multihashing-async')
Use in a browser with browserify, webpack or any other bundler

The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.

const multihashing = require('multihashing-async')
Use in a browser Using a script tag

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

<script src="https://unpkg.com/multihashing-async/dist/index.min.js"></script>

<script src="https://unpkg.com/multihashing-async/dist/index.js"></script>
Usage
const multihashing = require('multihashing-async')
const bytes = new TextEncoder().encode('beep boop')

const mh = await multihashing(bytes, 'sha1')


const digest = await multihashing.digest(bytes, 'sha1')


const hash = multihashing.createHash('sha1')
const digest = await hash(bytes)
Examples Multihash output
const multihashing = require('multihashing-async')
const bytes = new TextEncoder().encode('beep boop')

const mh = await multihashing(bytes, 'sha1')
console.log(mh)


const mh = await multihashing(bytes, 'sha2-256')
console.log(mh)


const mh = await multihashing(bytes, 'sha2-512')
console.log(mh)

API

https://multiformats.github.io/js-multihashing-async/

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document 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.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © Protocol Labs Inc.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4