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

Package detail

@multiformats/sha3

multiformats48.2kApache-2.0 OR MIT3.0.2TypeScript support: included

Multiformats hash functions for SHA3

blake2, hash, ipfs, ipld, multiformats, multihash

readme

@multiformats/sha3

multiformats.io codecov CI

Multiformats hash functions for SHA3

Table of contents

Install

$ npm i @multiformats/sha3

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 { sha3256 as hasher } from '@multiformats/sha3'

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

run().catch(console.error)

Usage

The @multiformats/sha3 package exports sha3*, shake* and keccak* MultihashHashers. The Multicodecs table defines these multihashes.

The following MultihashHashers are exported:

  • sha3224 - SHA3-224
  • sha3256 - SHA3-256
  • sha3384 - SHA3-384
  • sha3512 - SHA3-512
  • shake128 - SHAKE-128 (256 output bits)
  • shake256 - SHAKE-256 (512 output bits)
  • keccak224 - KECCAK-224
  • keccak256 - KECCAK-256
  • keccak384 - KECCAK-384
  • keccak512 - KECCAK-512

e.g. he sha3-384, multicodec code 0x15, may be imported as:

import { sha3384 } from '@multiformats/sha3'

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

3.0.2 (2024-01-02)

Dependencies

  • bump multiformats from 12.1.3 to 13.0.0 (fd0e9c7)

Tests

  • adjust multihashhasher interface for new multiformats (80e7bc1)

3.0.1 (2023-10-03)

Dependencies

  • dev: bump aegir from 40.0.13 to 41.0.0 (911f2a0)

3.0.0 (2023-08-31)

⚠ BREAKING CHANGES

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

Features

  • publish as esm-only, use aegir, multiformats@12 (50d390b)

Bug Fixes

Trivial Changes

2.0.17 (2023-05-16)

Trivial Changes

  • deps-dev: bump polendina from 3.1.0 to 3.2.1 (77ed0fa)

2.0.16 (2023-03-17)

Bug Fixes

  • release with Node.js 18 (05e0ee7)

Trivial Changes

  • deps-dev: bump @ipld/dag-cbor from 7.0.3 to 9.0.0 (#46) (8a4ba7f)
  • deps-dev: bump typescript from 4.9.5 to 5.0.2 (23d2c85)

2.0.15 (2023-01-06)

Trivial Changes

  • deps: bump actions/setup-node from 3.5.1 to 3.6.0 (#45) (f7c7968)

2.0.14 (2022-12-08)

Trivial Changes

  • deps-dev: bump typescript from 4.8.4 to 4.9.4 (#40) (465e7b6)
  • no-release: bump actions/setup-node from 3.4.1 to 3.5.0 (#33) (f66c908)
  • no-release: bump actions/setup-node from 3.5.0 to 3.5.1 (#35) (3d648e6)

2.0.13 (2022-08-26)

Trivial Changes

  • deps-dev: bump typescript from 4.7.4 to 4.8.2 (#32) (165cdb8)
  • no-release: bump actions/setup-node from 3.2.0 to 3.3.0 (#29) (620365c)
  • no-release: bump actions/setup-node from 3.3.0 to 3.4.0 (#30) (f9469b8)
  • no-release: bump actions/setup-node from 3.4.0 to 3.4.1 (#31) (78815ec)

2.0.12 (2022-05-25)

Trivial Changes

  • deps-dev: bump typescript from 4.6.4 to 4.7.2 (#28) (5921a6d)
  • no-release: bump actions/setup-node from 3.1.1 to 3.2.0 (#27) (1c4b680)

2.0.11 (2022-05-11)

Trivial Changes

  • deps-dev: bump polendina from 3.0.0 to 3.1.0 (4b41c23)

2.0.10 (2022-05-02)

Trivial Changes

  • deps-dev: bump mocha from 9.2.2 to 10.0.0 (57f439e)

2.0.9 (2022-05-02)

Trivial Changes

  • deps-dev: bump polendina from 2.0.15 to 3.0.0 (25a89ab)
  • no-release: bump actions/checkout from 2.4.0 to 3 (#20) (6c8cf97)
  • no-release: bump actions/setup-node from 3.0.0 to 3.1.0 (#21) (fd96767)
  • no-release: bump actions/setup-node from 3.1.0 to 3.1.1 (#22) (7d79542)
  • no-release: bump standard from 16.0.4 to 17.0.0 (#23) (3ea7e92)

2.0.8 (2022-03-01)

Trivial Changes

  • deps-dev: bump typescript from 4.5.5 to 4.6.2 (#18) (15c9bbd)
  • no-release: bump @ipld/dag-cbor from 6.0.15 to 7.0.0 (#14) (c9c4f42)
  • no-release: bump actions/setup-node from 2.5.0 to 2.5.1 (#15) (60d39ec)
  • no-release: bump actions/setup-node from 2.5.1 to 3.0.0 (#17) (7162fbf)

2.0.7 (2021-12-10)

Bug Fixes

  • test all environments w/ polendina (a582c64)

2.0.6 (2021-12-10)

Trivial Changes

  • update testing, sync with latest patterns (#13) (e90edf2)

2.0.5 (2021-12-08)

Trivial Changes

  • deps-dev: bump polendina from 1.1.1 to 2.0.0 (#12) (b9ef7c4)
  • no-release: bump actions/setup-node from 2.4.1 to 2.5.0 (#11) (f1d9ac6)

2.0.4 (2021-11-04)

Trivial Changes

  • deps: bump actions/checkout from 2.3.5 to 2.4.0 (31b5ee5)

2.0.3 (2021-10-18)

Trivial Changes

  • deps: bump actions/checkout from 2.3.4 to 2.3.5 (6d5528a)

2.0.2 (2021-09-28)

Trivial Changes

  • deps: bump actions/setup-node from 2.4.0 to 2.4.1 (38c28bd)

2.0.1 (2021-08-06)

Trivial Changes

  • deps: bump actions/setup-node from 2.1.5 to 2.4.0 (9599a63)

2.0.0 (2021-07-16)

⚠ BREAKING CHANGES

  • add types, update deps, semantic-release, dependabot

Features

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

Trivial Changes

  • add example, fix up README (6948f58)

1.1.0 (2021-07-16)

Features

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

Trivial Changes

  • add example, fix up README (dfa18ba)