@dcl/hashing
TypeScript icon, indicating that this package has built-in type declarations

3.0.4 • Public • Published

@dcl/hashing

Hashing functions to calculate Decentraland Content Identifiers

  • hashV1(arg): Promise<string>: ba prefixed hashes are IPFSv1 hashes. Calculating hashes for files should generate the same result as an IPFS node.
  • DEPRECATED hashV0(arg): Promise<string>: Qm prefixed hashes are not IPFSv0 hashes, although it uses the same encoding (Qm...). These

npm i @dcl/hashing

import { hashV1 } from '@dcl/hashing'

// use with Node.js Buffers or Uint8Array
cid = await hashV1(fs.readFileSync('file'))

// use with fs.ReadStream
cid = await hashV1(fs.createReadStream('file'))

// => bafybeibdik2ihfpcdi7aaaguptwcoc5msav7uhn5hu54xlq2pdwkh5arzy

Readme

Keywords

none

Package Sidebar

Install

npm i @dcl/hashing

Weekly Downloads

2,161

Version

3.0.4

License

Apache-2.0

Unpacked Size

302 kB

Total Files

11

Last publish

Collaborators

  • decentralandbot