@quentinadam/hash 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Buffers.d.ts +3 -0
- package/dist/Buffers.js +1 -0
- package/dist/blake2b128.d.ts +2 -2
- package/dist/blake2b128.js +2 -1
- package/dist/blake2b160.d.ts +2 -2
- package/dist/blake2b160.js +2 -1
- package/dist/blake2b224.d.ts +2 -2
- package/dist/blake2b224.js +2 -1
- package/dist/blake2b256.d.ts +2 -2
- package/dist/blake2b256.js +2 -1
- package/dist/blake2b512.d.ts +2 -2
- package/dist/blake2b512.js +2 -1
- package/dist/concat.d.ts +2 -2
- package/dist/expectUint8Array.d.ts +1 -0
- package/dist/expectUint8Array.js +8 -0
- package/dist/generateHmac.d.ts +2 -1
- package/dist/generateHmac.js +1 -1
- package/dist/hmac-sha1.d.ts +2 -1
- package/dist/hmac-sha1.js +1 -1
- package/dist/hmac-sha224.d.ts +2 -1
- package/dist/hmac-sha224.js +1 -1
- package/dist/hmac-sha256.d.ts +2 -1
- package/dist/hmac-sha256.js +1 -1
- package/dist/hmac-sha384.d.ts +2 -1
- package/dist/hmac-sha384.js +1 -1
- package/dist/hmac-sha512.d.ts +2 -1
- package/dist/hmac-sha512.js +1 -1
- package/dist/keccak256.d.ts +2 -2
- package/dist/keccak256.js +2 -1
- package/dist/md5.d.ts +2 -2
- package/dist/md5.js +2 -1
- package/dist/ripemd160.d.ts +2 -2
- package/dist/ripemd160.js +2 -1
- package/dist/sha1.d.ts +2 -2
- package/dist/sha1.js +2 -1
- package/dist/sha224.d.ts +2 -2
- package/dist/sha224.js +2 -1
- package/dist/sha256.d.ts +2 -2
- package/dist/sha256.js +2 -1
- package/dist/sha384.d.ts +2 -2
- package/dist/sha384.js +2 -1
- package/dist/sha512.d.ts +2 -2
- package/dist/sha512.js +2 -1
- package/package.json +2 -1
package/dist/Buffers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/blake2b128.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function blake2b128(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function blake2b128(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/blake2b128.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { blake2b as hash } from '@noble/hashes/blake2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function blake2b128(...buffers) {
|
|
4
|
-
return hash(concat(buffers), { dkLen: 16 });
|
|
5
|
+
return expectUint8Array(hash(concat(buffers), { dkLen: 16 }));
|
|
5
6
|
}
|
package/dist/blake2b160.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function blake2b160(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function blake2b160(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/blake2b160.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { blake2b as hash } from '@noble/hashes/blake2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function blake2b160(...buffers) {
|
|
4
|
-
return hash(concat(buffers), { dkLen: 20 });
|
|
5
|
+
return expectUint8Array(hash(concat(buffers), { dkLen: 20 }));
|
|
5
6
|
}
|
package/dist/blake2b224.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function blake2b224(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function blake2b224(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/blake2b224.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { blake2b as hash } from '@noble/hashes/blake2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function blake2b224(...buffers) {
|
|
4
|
-
return hash(concat(buffers), { dkLen: 28 });
|
|
5
|
+
return expectUint8Array(hash(concat(buffers), { dkLen: 28 }));
|
|
5
6
|
}
|
package/dist/blake2b256.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function blake2b256(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function blake2b256(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/blake2b256.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { blake2b as hash } from '@noble/hashes/blake2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function blake2b256(...buffers) {
|
|
4
|
-
return hash(concat(buffers), { dkLen: 32 });
|
|
5
|
+
return expectUint8Array(hash(concat(buffers), { dkLen: 32 }));
|
|
5
6
|
}
|
package/dist/blake2b512.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function blake2b512(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function blake2b512(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/blake2b512.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { blake2b as hash } from '@noble/hashes/blake2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function blake2b512(...buffers) {
|
|
4
|
-
return hash(concat(buffers), { dkLen: 64 });
|
|
5
|
+
return expectUint8Array(hash(concat(buffers), { dkLen: 64 }));
|
|
5
6
|
}
|
package/dist/concat.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function concat(buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function concat(buffers: Buffers): Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function expectUint8Array(value: unknown): Uint8Array<ArrayBuffer>;
|
package/dist/generateHmac.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function generateHmac(hash: (buffer: Uint8Array<ArrayBuffer>) => Uint8Array<ArrayBuffer>, blockSize: number): (secret: Buffer, ...buffers: Buffers) => Uint8Array<ArrayBuffer>;
|
package/dist/generateHmac.js
CHANGED
|
@@ -16,6 +16,6 @@ export default function generateHmac(hash, blockSize) {
|
|
|
16
16
|
innerKey[i] = 0x36 ^ ensure(secret[i]);
|
|
17
17
|
outerKey[i] = 0x5c ^ ensure(secret[i]);
|
|
18
18
|
}
|
|
19
|
-
return hash(
|
|
19
|
+
return hash(concat([outerKey, hash(concat([innerKey, concat(buffers)]))]));
|
|
20
20
|
};
|
|
21
21
|
}
|
package/dist/hmac-sha1.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function hmacSha1(secret: Buffer, ...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/hmac-sha1.js
CHANGED
package/dist/hmac-sha224.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function hmacSha224(secret: Buffer, ...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/hmac-sha224.js
CHANGED
package/dist/hmac-sha256.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function hmacSha256(secret: Buffer, ...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/hmac-sha256.js
CHANGED
package/dist/hmac-sha384.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function hmacSha384(secret: Buffer, ...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/hmac-sha384.js
CHANGED
package/dist/hmac-sha512.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type Buffer from './Buffer.ts';
|
|
2
|
-
|
|
2
|
+
import type Buffers from './Buffers.ts';
|
|
3
|
+
export default function hmacSha512(secret: Buffer, ...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/hmac-sha512.js
CHANGED
package/dist/keccak256.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function keccak256(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function keccak256(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/keccak256.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { keccak_256 as hash } from '@noble/hashes/sha3.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function keccak256(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/md5.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function md5(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function md5(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/md5.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { md5 as hash } from '@noble/hashes/legacy.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function md5(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/ripemd160.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function ripemd160(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function ripemd160(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/ripemd160.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ripemd160 as hash } from '@noble/hashes/legacy.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function ripemd160(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/sha1.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function sha1(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function sha1(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/sha1.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha1 as hash } from '@noble/hashes/legacy.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function sha1(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/sha224.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function sha224(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function sha224(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/sha224.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha224 as hash } from '@noble/hashes/sha2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function sha224(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/sha256.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function sha256(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function sha256(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/sha256.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha256 as hash } from '@noble/hashes/sha2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function sha256(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/sha384.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function sha384(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function sha384(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/sha384.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha384 as hash } from '@noble/hashes/sha2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function sha384(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/dist/sha512.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function sha512(...buffers:
|
|
1
|
+
import type Buffers from './Buffers.ts';
|
|
2
|
+
export default function sha512(...buffers: Buffers): Uint8Array<ArrayBuffer>;
|
package/dist/sha512.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha512 as hash } from '@noble/hashes/sha2.js';
|
|
2
2
|
import concat from "./concat.js";
|
|
3
|
+
import expectUint8Array from "./expectUint8Array.js";
|
|
3
4
|
export default function sha512(...buffers) {
|
|
4
|
-
return hash(concat(buffers));
|
|
5
|
+
return expectUint8Array(hash(concat(buffers)));
|
|
5
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quentinadam/hash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "A simple hash library that wraps npm:@noble/hashes",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Quentin Adam",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@noble/hashes": "^2.0.0",
|
|
39
|
+
"@quentinadam/assert": "^0.1.12",
|
|
39
40
|
"@quentinadam/ensure": "^0.1.1",
|
|
40
41
|
"@quentinadam/uint8array-extension": "^0.1.7"
|
|
41
42
|
}
|