@wishknish/knishio-client-js 0.7.8 → 0.8.0
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/package.json
CHANGED
package/src/libraries/crypto.js
CHANGED
|
@@ -60,8 +60,9 @@ export function generateSecret (seed = null, length = 2048) {
|
|
|
60
60
|
if (seed) {
|
|
61
61
|
const sponge = new JsSHA('SHAKE256', 'TEXT')
|
|
62
62
|
sponge.update(seed)
|
|
63
|
-
//
|
|
64
|
-
|
|
63
|
+
// outputLen is in BITS. For `length` hex chars = length/2 bytes = length*4 bits.
|
|
64
|
+
// (length=2048 → 8192 bits → 1024 bytes → 2048 hex chars, matching all SDKs.)
|
|
65
|
+
return sponge.getHash('HEX', { outputLen: length * 4 })
|
|
65
66
|
} else {
|
|
66
67
|
return randomString(length)
|
|
67
68
|
}
|