@sequencemedia/pbkdf2 1.0.9 → 1.0.11
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/README.md +3 -1
- package/compare.sh +42 -15
- package/package.json +2 -2
- package/scripts/compare.mjs +2 -3
- package/scripts/hash.mjs +2 -2
- package/scripts/salt.mjs +0 -0
- package/utils/common.mjs +0 -8
package/README.md
CHANGED
|
@@ -13,8 +13,10 @@ A password can be compared with a `hash` and `salt` (and the number of `iteratio
|
|
|
13
13
|
The ES functions expect the same argument types as the underlying Node utilities
|
|
14
14
|
|
|
15
15
|
- The `hash` is a `Buffer`
|
|
16
|
-
- The `salt` is a `
|
|
16
|
+
- The `salt` is a `Buffer`
|
|
17
17
|
- `iterations` is a `Number`
|
|
18
|
+
- `keylen` is a `Number`
|
|
19
|
+
- `digest` is a `String`
|
|
18
20
|
|
|
19
21
|
Etc.
|
|
20
22
|
|
package/compare.sh
CHANGED
|
@@ -1,25 +1,52 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
# the-user-1
|
|
3
|
+
# the-user-1 (UMS)
|
|
4
4
|
npm run compare -- \
|
|
5
|
-
--password
|
|
6
|
-
--hash
|
|
7
|
-
--salt
|
|
5
|
+
--password '^49pPaRdVSNC' \
|
|
6
|
+
--hash 'kOhpM7//M4I9+WcWLH7vbb/yN2+8qKyxQ0xAfI4JzamcRMdwwl7vAh0ch7UJ0JoBe9AqaAGuUJZF/mVA9EqaLQ==' \
|
|
7
|
+
--salt 'YzFjMTY4MmMyMWE4MjFkYjRhNWE5YjJmNDY0OTUzM2Q=' \
|
|
8
8
|
--iterations 32768 \
|
|
9
|
-
--digest sha512
|
|
9
|
+
--digest 'sha512'
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# the-user-1 (Keycloak)
|
|
12
12
|
npm run compare -- \
|
|
13
|
-
--password
|
|
14
|
-
--hash
|
|
15
|
-
--salt
|
|
13
|
+
--password '$b!6A6t7M7URi.' \
|
|
14
|
+
--hash 'zC9qCa/0XjQOt/fy/XFZ69rvnw6w6hueI294PnqmPeKOeMH3Qr8S5RWhg1v+b60DhkcSlw1FKZWpgNjsQflxYA==' \
|
|
15
|
+
--salt '9xdUcOPkoYYS/kr2URMArw==' \
|
|
16
|
+
--iterations 27500 \
|
|
17
|
+
--digest 'sha256' \
|
|
18
|
+
--keylen 64
|
|
19
|
+
|
|
20
|
+
# the-user-2 (UMS)
|
|
21
|
+
npm run compare -- \
|
|
22
|
+
--password 'S0uSaC&FzDOO' \
|
|
23
|
+
--hash 'BrtOel2qy5HrYWn45jBKf5b3HUKdVeQfIj1ljhGxQ/SiWsmMMuOl756H4MXkMOnVJKrgFfHFy7cgFXUaSFA2ow==' \
|
|
24
|
+
--salt 'MDI2OGM0MDU4NWJiOTgxNWEyYzQwN2RkYjM1YTY5YWU=' \
|
|
16
25
|
--iterations 32768 \
|
|
17
|
-
--digest sha512
|
|
26
|
+
--digest 'sha512'
|
|
27
|
+
|
|
28
|
+
# the-user-2 (Keycloak)
|
|
29
|
+
npm run compare -- \
|
|
30
|
+
--password 'CJPRki*Qx4GsL9' \
|
|
31
|
+
--salt '+7WfVsQDJwz3NhT7sIVAGA==' \
|
|
32
|
+
--hash 'dA0brxazVBjCiiWGJOvUjGKZzEsdHaooUYRWhz3gYsPQJlADznYzk+9Mlzh0AHNgbo4vlWFMGm6vIQC2DxucJw==' \
|
|
33
|
+
--iterations 27500 \
|
|
34
|
+
--digest 'sha256' \
|
|
35
|
+
--keylen 64
|
|
18
36
|
|
|
19
|
-
# the-user-3
|
|
37
|
+
# the-user-3 (UMS)
|
|
20
38
|
npm run compare -- \
|
|
21
|
-
--password
|
|
22
|
-
--hash
|
|
23
|
-
--salt
|
|
39
|
+
--password '@^EJmdlkt5A#' \
|
|
40
|
+
--hash 'bV76sVqsM0doKBFnaHsZQC9OgcVnF/+gzkG7HFXdD7jyQdN1PqCVijyXKMijmYQPWJohi5f7sVxhoLJ5kf8aQA==' \
|
|
41
|
+
--salt 'ZDI3OTZmZWU3M2I3M2Y3MTgxMmYyNGM3MjU4NDE2NDM=' \
|
|
24
42
|
--iterations 32768 \
|
|
25
|
-
--digest sha512
|
|
43
|
+
--digest 'sha512'
|
|
44
|
+
|
|
45
|
+
# the-user-3 (Keycloak)
|
|
46
|
+
npm run compare -- \
|
|
47
|
+
--password 'Q*edKXB@@u#7kN' \
|
|
48
|
+
--hash 'Pmmom2yEUX0/M1chwCdyHM0WMiyAoHEVOmbRNUN/695FlkZMPSxSMwBLPBgYoKbP1Shir/NDBWcH6mgtHFPyYw==' \
|
|
49
|
+
--salt 't8U4ClO+biQUa9amFn4bUA==' \
|
|
50
|
+
--iterations 27500 \
|
|
51
|
+
--digest 'sha256' \
|
|
52
|
+
--keylen 64
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/pbkdf2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"pbkdf2",
|
|
6
6
|
"crypto",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@babel/core": "^7.20.12",
|
|
41
41
|
"@babel/eslint-parser": "^7.19.1",
|
|
42
42
|
"@babel/preset-env": "^7.20.2",
|
|
43
|
-
"@sequencemedia/hooks": "^1.0.
|
|
43
|
+
"@sequencemedia/hooks": "^1.0.320",
|
|
44
44
|
"@types/node": "^18.11.18",
|
|
45
45
|
"chai": "^4.3.7",
|
|
46
46
|
"core-js": "^3.27.2",
|
package/scripts/compare.mjs
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
import argsMap from '#utils/args-map'
|
|
4
4
|
import compare from '#utils/compare'
|
|
5
5
|
import {
|
|
6
|
-
fromBase64ToBuffer
|
|
7
|
-
fromBase64
|
|
6
|
+
fromBase64ToBuffer
|
|
8
7
|
} from '#utils/common'
|
|
9
8
|
import {
|
|
10
9
|
ITERATIONS,
|
|
@@ -19,7 +18,7 @@ if (!argsMap.has('hash')) throw new Error('Parameter `hash` is required')
|
|
|
19
18
|
const hash = fromBase64ToBuffer(argsMap.get('hash'))
|
|
20
19
|
|
|
21
20
|
if (!argsMap.has('salt')) throw new Error('Parameter `salt` is required')
|
|
22
|
-
const salt =
|
|
21
|
+
const salt = fromBase64ToBuffer(argsMap.get('salt'))
|
|
23
22
|
|
|
24
23
|
const iterations = (
|
|
25
24
|
argsMap.has('iterations')
|
package/scripts/hash.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import argsMap from '#utils/args-map'
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
fromBase64ToBuffer,
|
|
6
6
|
fromBufferToBase64
|
|
7
7
|
} from '#utils/common'
|
|
8
8
|
import hash from '#utils/hash'
|
|
@@ -16,7 +16,7 @@ if (!argsMap.has('password')) throw new Error('Parameter `password` is required'
|
|
|
16
16
|
const password = argsMap.get('password')
|
|
17
17
|
|
|
18
18
|
if (!argsMap.has('salt')) throw new Error('Parameter `salt` is required')
|
|
19
|
-
const salt =
|
|
19
|
+
const salt = fromBase64ToBuffer(argsMap.get('salt'))
|
|
20
20
|
|
|
21
21
|
const iterations = (
|
|
22
22
|
argsMap.has('iterations')
|
package/scripts/salt.mjs
CHANGED
|
File without changes
|
package/utils/common.mjs
CHANGED
|
@@ -5,11 +5,3 @@ export function fromBase64ToBuffer (string) {
|
|
|
5
5
|
export function fromBufferToBase64 (buffer) {
|
|
6
6
|
return buffer.toString('base64')
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
export function fromBase64 (string) {
|
|
10
|
-
return Buffer.from(string, 'base64').toString('ascii')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function toBase64 (string) {
|
|
14
|
-
return Buffer.from(string).toString('base64')
|
|
15
|
-
}
|