@quentinadam/hash 0.1.1 → 0.1.3

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.
@@ -1,4 +1,4 @@
1
- import { blake2b as hash } from '@noble/hashes/blake2b';
1
+ import { blake2b as hash } from '@noble/hashes/blake2';
2
2
  import concat from "./concat.js";
3
3
  export default function blake2b128(...buffers) {
4
4
  return hash(concat(buffers), { dkLen: 16 });
@@ -1,4 +1,4 @@
1
- import { blake2b as hash } from '@noble/hashes/blake2b';
1
+ import { blake2b as hash } from '@noble/hashes/blake2';
2
2
  import concat from "./concat.js";
3
3
  export default function blake2b160(...buffers) {
4
4
  return hash(concat(buffers), { dkLen: 20 });
@@ -1,4 +1,4 @@
1
- import { blake2b as hash } from '@noble/hashes/blake2b';
1
+ import { blake2b as hash } from '@noble/hashes/blake2';
2
2
  import concat from "./concat.js";
3
3
  export default function blake2b224(...buffers) {
4
4
  return hash(concat(buffers), { dkLen: 28 });
@@ -1,4 +1,4 @@
1
- import { blake2b as hash } from '@noble/hashes/blake2b';
1
+ import { blake2b as hash } from '@noble/hashes/blake2';
2
2
  import concat from "./concat.js";
3
3
  export default function blake2b256(...buffers) {
4
4
  return hash(concat(buffers), { dkLen: 32 });
@@ -1,4 +1,4 @@
1
- import { blake2b as hash } from '@noble/hashes/blake2b';
1
+ import { blake2b as hash } from '@noble/hashes/blake2';
2
2
  import concat from "./concat.js";
3
3
  export default function blake2b512(...buffers) {
4
4
  return hash(concat(buffers), { dkLen: 64 });
@@ -1,4 +1,4 @@
1
- import require from '@quentinadam/require';
1
+ import ensure from '@quentinadam/require';
2
2
  import Uint8ArrayExtension from '@quentinadam/uint8array-extension';
3
3
  import concat from "./concat.js";
4
4
  export default function generateHmac(hash, blockSize) {
@@ -13,8 +13,8 @@ export default function generateHmac(hash, blockSize) {
13
13
  const innerKey = new Uint8Array(blockSize);
14
14
  const outerKey = new Uint8Array(blockSize);
15
15
  for (let i = 0; i < blockSize; i++) {
16
- innerKey[i] = 0x36 ^ require(secret[i]);
17
- outerKey[i] = 0x5c ^ require(secret[i]);
16
+ innerKey[i] = 0x36 ^ ensure(secret[i]);
17
+ outerKey[i] = 0x5c ^ ensure(secret[i]);
18
18
  }
19
19
  return hash(Uint8ArrayExtension.concat([outerKey, hash(Uint8ArrayExtension.concat([innerKey, concat(buffers)]))]));
20
20
  };
package/dist/hmac-sha1.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha1 as hash } from '@noble/hashes/sha1';
1
+ import { sha1 as hash } from '@noble/hashes/legacy';
2
2
  import generateHmac from "./generateHmac.js";
3
3
  export default function hmacSha1(secret, ...buffers) {
4
4
  return generateHmac(hash, 64)(secret, ...buffers);
@@ -1,4 +1,4 @@
1
- import { sha224 as hash } from '@noble/hashes/sha256';
1
+ import { sha224 as hash } from '@noble/hashes/sha2';
2
2
  import generateHmac from "./generateHmac.js";
3
3
  export default function hmacSha224(secret, ...buffers) {
4
4
  return generateHmac(hash, 64)(secret, ...buffers);
@@ -1,4 +1,4 @@
1
- import { sha256 as hash } from '@noble/hashes/sha256';
1
+ import { sha256 as hash } from '@noble/hashes/sha2';
2
2
  import generateHmac from "./generateHmac.js";
3
3
  export default function hmacSha256(secret, ...buffers) {
4
4
  return generateHmac(hash, 64)(secret, ...buffers);
@@ -1,4 +1,4 @@
1
- import { sha384 as hash } from '@noble/hashes/sha512';
1
+ import { sha384 as hash } from '@noble/hashes/sha2';
2
2
  import generateHmac from "./generateHmac.js";
3
3
  export default function hmacSha384(secret, ...buffers) {
4
4
  return generateHmac(hash, 128)(secret, ...buffers);
@@ -1,4 +1,4 @@
1
- import { sha512 as hash } from '@noble/hashes/sha512';
1
+ import { sha512 as hash } from '@noble/hashes/sha2';
2
2
  import generateHmac from "./generateHmac.js";
3
3
  export default function hmacSha512(secret, ...buffers) {
4
4
  return generateHmac(hash, 128)(secret, ...buffers);
package/dist/md5.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type Buffer from './Buffer.ts';
2
+ export default function md5(...buffers: (Buffer | undefined)[]): Uint8Array;
package/dist/md5.js ADDED
@@ -0,0 +1,5 @@
1
+ import { md5 as hash } from '@noble/hashes/legacy';
2
+ import concat from "./concat.js";
3
+ export default function md5(...buffers) {
4
+ return hash(concat(buffers));
5
+ }
package/dist/mod.d.ts CHANGED
@@ -9,10 +9,11 @@ import hmacSha256 from './hmac-sha256.ts';
9
9
  import hmacSha384 from './hmac-sha384.ts';
10
10
  import hmacSha512 from './hmac-sha512.ts';
11
11
  import keccak256 from './keccak256.ts';
12
+ import md5 from './md5.ts';
12
13
  import ripemd160 from './ripemd160.ts';
13
14
  import sha1 from './sha1.ts';
14
15
  import sha224 from './sha224.ts';
15
16
  import sha256 from './sha256.ts';
16
17
  import sha384 from './sha384.ts';
17
18
  import sha512 from './sha512.ts';
18
- export { blake2b128, blake2b160, blake2b224, blake2b256, blake2b512, hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, keccak256, ripemd160, sha1, sha224, sha256, sha384, sha512, };
19
+ export { blake2b128, blake2b160, blake2b224, blake2b256, blake2b512, hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, keccak256, md5, ripemd160, sha1, sha224, sha256, sha384, sha512, };
package/dist/mod.js CHANGED
@@ -9,10 +9,11 @@ import hmacSha256 from "./hmac-sha256.js";
9
9
  import hmacSha384 from "./hmac-sha384.js";
10
10
  import hmacSha512 from "./hmac-sha512.js";
11
11
  import keccak256 from "./keccak256.js";
12
+ import md5 from "./md5.js";
12
13
  import ripemd160 from "./ripemd160.js";
13
14
  import sha1 from "./sha1.js";
14
15
  import sha224 from "./sha224.js";
15
16
  import sha256 from "./sha256.js";
16
17
  import sha384 from "./sha384.js";
17
18
  import sha512 from "./sha512.js";
18
- export { blake2b128, blake2b160, blake2b224, blake2b256, blake2b512, hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, keccak256, ripemd160, sha1, sha224, sha256, sha384, sha512, };
19
+ export { blake2b128, blake2b160, blake2b224, blake2b256, blake2b512, hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, keccak256, md5, ripemd160, sha1, sha224, sha256, sha384, sha512, };
package/dist/ripemd160.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ripemd160 as hash } from '@noble/hashes/ripemd160';
1
+ import { ripemd160 as hash } from '@noble/hashes/legacy';
2
2
  import concat from "./concat.js";
3
3
  export default function ripemd160(...buffers) {
4
4
  return hash(concat(buffers));
package/dist/sha1.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha1 as hash } from '@noble/hashes/sha1';
1
+ import { sha1 as hash } from '@noble/hashes/legacy';
2
2
  import concat from "./concat.js";
3
3
  export default function sha1(...buffers) {
4
4
  return hash(concat(buffers));
package/dist/sha224.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha224 as hash } from '@noble/hashes/sha256';
1
+ import { sha224 as hash } from '@noble/hashes/sha2';
2
2
  import concat from "./concat.js";
3
3
  export default function sha224(...buffers) {
4
4
  return hash(concat(buffers));
package/dist/sha256.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha256 as hash } from '@noble/hashes/sha256';
1
+ import { sha256 as hash } from '@noble/hashes/sha2';
2
2
  import concat from "./concat.js";
3
3
  export default function sha256(...buffers) {
4
4
  return hash(concat(buffers));
package/dist/sha384.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha384 as hash } from '@noble/hashes/sha512';
1
+ import { sha384 as hash } from '@noble/hashes/sha2';
2
2
  import concat from "./concat.js";
3
3
  export default function sha384(...buffers) {
4
4
  return hash(concat(buffers));
package/dist/sha512.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha512 as hash } from '@noble/hashes/sha512';
1
+ import { sha512 as hash } from '@noble/hashes/sha2';
2
2
  import concat from "./concat.js";
3
3
  export default function sha512(...buffers) {
4
4
  return hash(concat(buffers));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quentinadam/hash",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A simple hash library that wraps npm:@noble/hashes",
5
5
  "license": "MIT",
6
6
  "author": "Quentin Adam",
@@ -22,6 +22,7 @@
22
22
  "./hmac-sha384": "./dist/hmac-sha384.js",
23
23
  "./hmac-sha512": "./dist/hmac-sha512.js",
24
24
  "./keccak256": "./dist/keccak256.js",
25
+ "./md5": "./dist/md5.js",
25
26
  "./ripemd160": "./dist/ripemd160.js",
26
27
  "./sha1": "./dist/sha1.js",
27
28
  "./sha224": "./dist/sha224.js",
@@ -34,7 +35,7 @@
34
35
  "README.md"
35
36
  ],
36
37
  "dependencies": {
37
- "@noble/hashes": "^1.6.1",
38
+ "@noble/hashes": "^1.8.0",
38
39
  "@quentinadam/require": "^0.1.4",
39
40
  "@quentinadam/uint8array-extension": "^0.1.5"
40
41
  }