Socket
Socket
Sign inDemoInstall

multiformats

Package Overview
Dependencies
0
Maintainers
2
Versions
147
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 12.0.2 to 12.1.0

dist/types/src/hashes/sha1-browser.d.ts

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [12.1.0](https://github.com/multiformats/js-multiformats/compare/v12.0.2...v12.1.0) (2023-08-28)
### Features
* add sha1 support ([4da0085](https://github.com/multiformats/js-multiformats/commit/4da008580dd3dc3fa2c5f14c5a3bf64fd99221e6))
## [12.0.2](https://github.com/multiformats/js-multiformats/compare/v12.0.1...v12.0.2) (2023-08-28)

@@ -2,0 +9,0 @@

1

dist/typedoc-urls.json

@@ -60,2 +60,3 @@ {

"from": "https://multiformats.github.io/js-multiformats/functions/hashes_hasher.from.html",
"sha1": "https://multiformats.github.io/js-multiformats/variables/hashes_sha1.sha1.html",
"sha256": "https://multiformats.github.io/js-multiformats/variables/hashes_sha2.sha256.html",

@@ -62,0 +63,0 @@ "sha512": "https://multiformats.github.io/js-multiformats/variables/hashes_sha2.sha512.html",

{
"name": "multiformats",
"version": "12.0.2",
"version": "12.1.0",
"description": "Interface for multihash, multicodec, multibase and CID",

@@ -151,2 +151,7 @@ "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)",

},
"./hashes/sha1": {
"types": "./dist/types/src/hashes/sha1.d.ts",
"browser": "./src/hashes/sha1-browser.js",
"import": "./src/hashes/sha1.js"
},
"./hashes/sha2": {

@@ -175,2 +180,4 @@ "types": "./dist/types/src/hashes/sha2.d.ts",

"browser": {
"./hashes/sha1": "./src/hashes/sha1-browser.js",
"./src/hashes/sha1.js": "./src/hashes/sha1-browser.js",
"./hashes/sha2": "./src/hashes/sha2-browser.js",

@@ -291,3 +298,4 @@ "./src/hashes/sha2.js": "./src/hashes/sha2-browser.js"

"buffer": "^6.0.3",
"cids": "^1.1.9"
"cids": "^1.1.9",
"crypto-hash": "^2.0.1"
},

@@ -294,0 +302,0 @@ "aegir": {

@@ -6,5 +6,7 @@ /* globals describe, it */

import { assert } from 'aegir/chai'
import { sha1 as chSha1 } from 'crypto-hash'
import { fromHex, fromString } from '../src/bytes.js'
import { decode as decodeDigest, create as createDigest } from '../src/hashes/digest.js'
import { identity } from '../src/hashes/identity.js'
import { sha1 } from '../src/hashes/sha1.js'
import { sha256, sha512 } from '../src/hashes/sha2.js'

@@ -44,2 +46,28 @@ import invalid from './fixtures/invalid-multihash.js'

it('hash sha1', async () => {
const hash = await sha1.digest(fromString('test'))
assert.deepStrictEqual(hash.code, sha1.code)
assert.deepStrictEqual(hash.digest, fromHex(await chSha1(fromString('test'))))
const hash2 = decodeDigest(hash.bytes)
assert.deepStrictEqual(hash2.code, sha1.code)
assert.deepStrictEqual(hash2.bytes, hash.bytes)
})
if (typeof navigator === 'undefined') {
it('sync sha1', async () => {
const hash = sha1.digest(fromString('test'))
if (hash instanceof Promise) {
assert.fail('expected sync result')
} else {
assert.deepStrictEqual(hash.code, sha1.code)
assert.deepStrictEqual(hash.digest, fromHex(await chSha1(fromString('test'))))
const hash2 = decodeDigest(hash.bytes)
assert.deepStrictEqual(hash2.code, sha1.code)
assert.deepStrictEqual(hash2.bytes, hash.bytes)
}
})
}
it('hash sha2-256', async () => {

@@ -46,0 +74,0 @@ const hash = await sha256.digest(fromString('test'))

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc