Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@napi-rs/blake-hash

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/blake-hash - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

47

index.d.ts

@@ -16,7 +16,23 @@ /* eslint-disable */

export class Blake2BParam {
constructor()
/**
* Use a secret key, so that BLAKE2 acts as a MAC. The maximum key length is `KEYBYTES` (64).
* An empty key is equivalent to having no key at all.
*/
key(key: Buffer): void
/**
* At most `SALTBYTES` (16). Shorter salts are padded with null bytes. An empty salt is
* equivalent to having no salt at all.
*/
salt(salt: Buffer): void
/**
* Set the length of the final hash in bytes, from 1 to `OUTBYTES` (64). Apart from
* controlling the length of the final `Hash`, this is also associated data, and changing it
* will result in a totally different hash.
*/
hashLength(length: number): void
/**
* At most `PERSONALBYTES` (16). Shorter personalizations are padded with null bytes. An empty
* personalization is equivalent to having no personalization at all.
*/
personal(personal: Buffer): void

@@ -26,11 +42,29 @@ fanout(fanout: number): void

maxLeafLength(length: number): void
/** From 0 (the default, meaning leaf or sequential) to 255. */
nodeDepth(depth: number): void
/** From 0 (the default, meaning sequential) to `OUTBYTES` (64). */
innerHashLength(length: number): void
}
export class Blake2SParam {
constructor()
/**
* Use a secret key, so that BLAKE2 acts as a MAC. The maximum key length is `KEYBYTES` (64).
* An empty key is equivalent to having no key at all.
*/
key(key: Buffer): void
/**
* At most `SALTBYTES` (16). Shorter salts are padded with null bytes. An empty salt is
* equivalent to having no salt at all.
*/
salt(salt: Buffer): void
/**
* Set the length of the final hash in bytes, from 1 to `OUTBYTES` (64). Apart from
* controlling the length of the final `Hash`, this is also associated data, and changing it
* will result in a totally different hash.
*/
hashLength(length: number): void
/**
* At most `PERSONALBYTES` (16). Shorter personalizations are padded with null bytes. An empty
* personalization is equivalent to having no personalization at all.
*/
personal(personal: Buffer): void

@@ -40,7 +74,8 @@ fanout(fanout: number): void

maxLeafLength(length: number): void
/** From 0 (the default, meaning leaf or sequential) to 255. */
nodeDepth(depth: number): void
/** From 0 (the default, meaning sequential) to `OUTBYTES` (64). */
innerHashLength(length: number): void
}
export class Blake2BpParam {
constructor()

@@ -51,3 +86,2 @@ key(key: Buffer): void

export class Blake2SpParam {
constructor()

@@ -58,3 +92,2 @@ key(key: Buffer): void

export class Blake2BHasher {
constructor()

@@ -67,3 +100,2 @@ static withParams(params: Blake2BParam): Blake2BHasher

export class Blake2BpHasher {
constructor()

@@ -76,3 +108,2 @@ static withParams(params: Blake2BpParam): Blake2BpHasher

export class Blake2SHasher {
constructor()

@@ -85,3 +116,2 @@ static withParams(params: Blake2SParam): Blake2SHasher

export class Blake2SpHasher {
constructor()

@@ -94,3 +124,2 @@ static withParams(params: Blake2SpParam): Blake2SpHasher

export class Blake3Hasher {
static deriveKey(context: string, keyMaterial: Buffer): Buffer

@@ -97,0 +126,0 @@ constructor()

45

package.json
{
"name": "@napi-rs/blake-hash",
"version": "1.3.0",
"version": "1.3.1",
"main": "index.js",

@@ -16,2 +16,3 @@ "types": "index.d.ts",

"armv7-unknown-linux-gnueabihf",
"arm-linux-androideabi",
"x86_64-unknown-linux-musl",

@@ -29,7 +30,7 @@ "x86_64-unknown-freebsd",

"devDependencies": {
"@napi-rs/cli": "^2.0.0-alpha.11",
"@napi-rs/cli": "^2.0.0",
"@node-rs/deno-lint": "^1.10.3",
"@node-rs/xxhash": "^1.0.0",
"@swc-node/register": "^1.3.7",
"@types/node": "^16.11.6",
"@node-rs/xxhash": "^1.0.1",
"@swc-node/register": "^1.4.2",
"@types/node": "^17.0.1",
"ava": "^3.15.0",

@@ -39,3 +40,3 @@ "benny": "^3.7.1",

"blake3": "^2.1.7",
"esbuild": "^0.13.13"
"esbuild": "^0.14.6"
},

@@ -65,2 +66,9 @@ "engines": {

},
"prettier": {
"printWidth": 80,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always"
},
"funding": {

@@ -71,15 +79,16 @@ "type": "github",

"optionalDependencies": {
"@napi-rs/blake-hash-win32-x64-msvc": "1.3.0",
"@napi-rs/blake-hash-darwin-x64": "1.3.0",
"@napi-rs/blake-hash-linux-x64-gnu": "1.3.0",
"@napi-rs/blake-hash-darwin-arm64": "1.3.0",
"@napi-rs/blake-hash-android-arm64": "1.3.0",
"@napi-rs/blake-hash-linux-arm64-gnu": "1.3.0",
"@napi-rs/blake-hash-linux-arm64-musl": "1.3.0",
"@napi-rs/blake-hash-win32-arm64-msvc": "1.3.0",
"@napi-rs/blake-hash-linux-arm-gnueabihf": "1.3.0",
"@napi-rs/blake-hash-linux-x64-musl": "1.3.0",
"@napi-rs/blake-hash-freebsd-x64": "1.3.0",
"@napi-rs/blake-hash-win32-ia32-msvc": "1.3.0"
"@napi-rs/blake-hash-win32-x64-msvc": "1.3.1",
"@napi-rs/blake-hash-darwin-x64": "1.3.1",
"@napi-rs/blake-hash-linux-x64-gnu": "1.3.1",
"@napi-rs/blake-hash-darwin-arm64": "1.3.1",
"@napi-rs/blake-hash-android-arm64": "1.3.1",
"@napi-rs/blake-hash-linux-arm64-gnu": "1.3.1",
"@napi-rs/blake-hash-linux-arm64-musl": "1.3.1",
"@napi-rs/blake-hash-win32-arm64-msvc": "1.3.1",
"@napi-rs/blake-hash-linux-arm-gnueabihf": "1.3.1",
"@napi-rs/blake-hash-android-arm-eabi": "1.3.1",
"@napi-rs/blake-hash-linux-x64-musl": "1.3.1",
"@napi-rs/blake-hash-freebsd-x64": "1.3.1",
"@napi-rs/blake-hash-win32-ia32-msvc": "1.3.1"
}
}

@@ -24,2 +24,3 @@ # `@napi-rs/blake-hash`

| Android arm64 | ✓ | ✓ | ✓ |
| Android armv7 | ✓ | ✓ | ✓ |
| FreeBSD x64 | ✓ | ✓ | ✓ |

@@ -34,7 +35,7 @@

```js
import { Blake2BHasher } from "@napi-rs/blake-hash";
import { Blake2BHasher } from '@napi-rs/blake-hash'
const hasher = new Blake2BHasher();
hasher.update("content to be hash");
hasher.digest("hex"); // could also be `base64` or `url-safe-base64`
const hasher = new Blake2BHasher()
hasher.update('content to be hash')
hasher.digest('hex') // could also be `base64` or `url-safe-base64`
```

@@ -45,10 +46,10 @@

```js
import { Blake2BHasher, Blake2BParam } from "@napi-rs/blake-hash";
import { Blake2BHasher, Blake2BParam } from '@napi-rs/blake-hash'
const hashParams = new Blake2BParam();
hashParams.personal("someone@email.com");
const hash = Blake2BHasher.withParams(hashParams);
const hashParams = new Blake2BParam()
hashParams.personal('someone@email.com')
const hash = Blake2BHasher.withParams(hashParams)
hash.update("your secret");
hash.digest("hex");
hash.update('your secret')
hash.digest('hex')
```

@@ -63,5 +64,5 @@

```js
import { blake3 } from "@napi-rs/blake-hash";
import { blake3 } from '@napi-rs/blake-hash'
blake3("hello"); //ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f
blake3('hello') //ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f
```

@@ -72,7 +73,7 @@

```js
import { Blake3Hasher } from "@napi-rs/blake-hash";
import { Blake3Hasher } from '@napi-rs/blake-hash'
const hasher = new Blake3Hasher();
hasher.update("hello");
hasher.digest("hex"); // ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f
const hasher = new Blake3Hasher()
hasher.update('hello')
hasher.digest('hex') // ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f
```

@@ -85,9 +86,9 @@

```js
import { randomBytes } from "crypto";
import { randomBytes } from 'crypto'
import { Blake3Hasher } from "@napi-rs/blake-hash";
import { Blake3Hasher } from '@napi-rs/blake-hash'
const hasher = Blake3Hasher.newKeyed(randomBytes(32)); // The key must be 32 bytes
hasher.update("hello");
hasher.digest("hex"); // 9e8e05888735e59036c1ec66938f5bdb2b3933ce647918b739c23b699f1431a3
const hasher = Blake3Hasher.newKeyed(randomBytes(32)) // The key must be 32 bytes
hasher.update('hello')
hasher.digest('hex') // 9e8e05888735e59036c1ec66938f5bdb2b3933ce647918b739c23b699f1431a3
```

@@ -114,9 +115,9 @@

```js
import { Blake3Hasher } from "@napi-rs/blake-hash";
import { Blake3Hasher } from '@napi-rs/blake-hash'
const context = "BLAKE3 2021-11-10 12:13:59 example context";
const context = 'BLAKE3 2021-11-10 12:13:59 example context'
const hasher = Blake3Hasher.newDeriveKey(context);
hasher.update("hello");
hasher.digest("hex"); // e186adf36b0c4e421b2baa881e158a4b3b074626882a6e1dfb231aebb7e149ee
const hasher = Blake3Hasher.newDeriveKey(context)
hasher.update('hello')
hasher.digest('hex') // e186adf36b0c4e421b2baa881e158a4b3b074626882a6e1dfb231aebb7e149ee
```

@@ -123,0 +124,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc