Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@multiformats/blake2

multiformats32kApache-2.0 OR MIT2.0.2TypeScript support: included

Multiformats BLAKE2 implementations

blake2, hash, ipfs, ipld, multiformats, multihash

readme

@multiformats/blake2

multiformats.io codecov CI

Multiformats BLAKE2 implementations

Table of contents

Install

$ npm i @multiformats/blake2

MultihashHasherss are exported from this library, they produce MultihashDigests. Details about these can be found in the multiformats multihash interface definitions.

import * as Block from 'multiformats/block'
import * as codec from '@ipld/dag-cbor'
import { blake2b256 as hasher } from '@multiformats/blake2/blake2b'

async function run () {
  const value = { hello: 'world' }
  const block = await Block.encode({ value, hasher, codec })
  console.log(block.cid)
  // -> CID(bafy2bzacedtxqx7k666ugf5mmagr2fxmbpfncbcji5jfg5uduausgb62y3av4)
}

run().catch(console.error)

Usage

The @multiformats/blake2/blake2b package exports blake2bX MultihashHashers, where X is the output length in bits. The Multicodecs table defines 64 different output lengths for BLAKE2b, from 8 to 512.

The @multiformats/blake2/blake2s package exports blake2sX MultihashHashers, where X is the output length in bits. For BLAKE2s, there are 32 different output lengths, from 8 to 256.

e.g. blake2b-256, multicodec code 0xb220, may be imported as:

import { blake2b256 } from '@multiformats/blake2/blake2b'

while blake2s-256, multicodec code 0xb260, may be imported as:

import { blake2s256 } from '@multiformats/blake2/blake2s'

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

changelog

2.0.2 (2024-01-02)

Dependencies

  • bump multiformats from 12.1.3 to 13.0.0 (445f07e)

Tests

  • update multihashhasher import (dd1e29e)

2.0.1 (2023-10-03)

Dependencies

  • dev: bump aegir from 40.0.13 to 41.0.0 (afdb158)

2.0.0 (2023-08-31)

⚠ BREAKING CHANGES

  • esm-only publish, use aegir, multiformats@12

Features

  • esm-only publish, use aegir, multiformats@12 (3ea977c)

Bug Fixes

Trivial Changes

1.0.13 (2023-01-06)

Trivial Changes

  • deps-dev: bump @ipld/dag-cbor from 8.0.1 to 9.0.0 (#41) (5cdb7b8)

1.0.12 (2022-12-09)

Trivial Changes

  • deps-dev: bump @ipld/dag-cbor from 7.0.3 to 8.0.0 (#35) (8ac6541)
  • deps-dev: bump typescript from 4.8.4 to 4.9.4 (#37) (55c1d47)

1.0.11 (2022-08-26)

Trivial Changes

  • deps-dev: bump typescript from 4.7.4 to 4.8.2 (#31) (a30724d)

1.0.10 (2022-05-26)

Trivial Changes

  • deps-dev: bump typescript from 4.6.4 to 4.7.2 (#30) (4173d23)
  • no-release: bump actions/checkout from 2.4.0 to 3 (#25) (c3bdd51)
  • no-release: bump mocha from 9.2.2 to 10.0.0 (#28) (c631070)
  • no-release: bump polendina from 2.0.15 to 3.0.0 (#27) (f392553)
  • no-release: bump polendina from 3.0.0 to 3.1.0 (#29) (f9af8ed)
  • no-release: bump standard from 16.0.4 to 17.0.0 (#26) (04a1772)

1.0.9 (2022-03-02)

Trivial Changes

  • deps-dev: bump typescript from 4.5.5 to 4.6.2 (#23) (af88175)
  • no-release: bump @ipld/dag-cbor from 6.0.15 to 7.0.0 (#18) (98269c4)
  • no-release: bump actions/setup-node from 2.5.0 to 2.5.1 (#20) (ed86152)
  • no-release: bump actions/setup-node from 2.5.1 to 3 (#22) (08eaebf)

1.0.8 (2021-12-10)

Bug Fixes

  • pin typescript and polendina to patch (a42e777)

1.0.7 (2021-12-10)

Trivial Changes

  • no-release: bump actions/setup-node from 2.4.1 to 2.5.0 (#14) (fcb21c6)
  • update testing, sync with latest patterns (3e0ccf7)

1.0.6 (2021-09-28)

Trivial Changes

  • deps: bump actions/setup-node from 2.4.0 to 2.4.1 (83b497a)

1.0.5 (2021-08-06)

Trivial Changes

  • deps: bump actions/setup-node from 2.3.2 to 2.4.0 (5922c92)

1.0.4 (2021-08-05)

Trivial Changes

  • deps: bump actions/setup-node from 2.3.1 to 2.3.2 (ec646fd)

1.0.3 (2021-08-04)

Trivial Changes

  • deps: bump actions/setup-node from 2.3.0 to 2.3.1 (18be629)

1.0.2 (2021-07-28)

Trivial Changes

  • deps: bump actions/setup-node from 2.2.0 to 2.3.0 (c4f1a97)
  • update deps, fix release with new ipjs (5298569)

1.0.1 (2021-07-15)

Trivial Changes

  • deps: bump actions/setup-node from 2.1.5 to 2.2.0 (1071dda)

1.0.0 (2021-07-15)

Features

  • add types, update deps, semantic-release, dependabot (d12595e)

Bug Fixes

  • clean up and simplify example (b293b38)
  • proper NPM_TOKEN env var naming (37cf535)