3.0.2 • Published 4 months ago

@multiformats/sha3 v3.0.2

Weekly downloads
1
License
Apache-2.0 OR MIT
Repository
github
Last release
4 months ago

@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.

3.0.2

4 months ago

3.0.1

7 months ago

3.0.0

8 months ago

2.0.17

12 months ago

2.0.16

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.5

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.4

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

2.0.0

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago