@zilliqa-js/crypto
Advanced tools
Comparing version 0.3.0 to 0.3.2
@@ -13,2 +13,3 @@ "use strict"; | ||
var util_2 = require("./util"); | ||
var ALGO_IDENTIFIER = 'aes-128-ctr'; | ||
/** | ||
@@ -82,3 +83,3 @@ * getDerivedKey | ||
crypto: { | ||
cipher: 'aes-128-ctr', | ||
cipher: ALGO_IDENTIFIER, | ||
cipherparams: { | ||
@@ -91,4 +92,10 @@ iv: iv.toString('hex'), | ||
mac: hash_js_1.default | ||
.sha256() | ||
.update(Buffer.concat([derivedKey.slice(16, 32), ciphertext]), 'hex') | ||
// @ts-ignore | ||
.hmac(hash_js_1.default.sha256, derivedKey, 'hex') | ||
.update(Buffer.concat([ | ||
derivedKey.slice(16, 32), | ||
ciphertext, | ||
iv, | ||
Buffer.from(ALGO_IDENTIFIER), | ||
]), 'hex') | ||
.digest('hex'), | ||
@@ -123,4 +130,10 @@ }, | ||
mac = hash_js_1.default | ||
.sha256() | ||
.update(Buffer.concat([derivedKey.slice(16, 32), ciphertext]), 'hex') | ||
// @ts-ignore | ||
.hmac(hash_js_1.default.sha256, derivedKey, 'hex') | ||
.update(Buffer.concat([ | ||
derivedKey.slice(16, 32), | ||
ciphertext, | ||
iv, | ||
Buffer.from(ALGO_IDENTIFIER), | ||
]), 'hex') | ||
.digest('hex'); | ||
@@ -127,0 +140,0 @@ // we need to do a byte-by-byte comparison to avoid non-constant time side |
{ | ||
"name": "@zilliqa-js/crypto", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"description": "Core crypto utilities for signing/verification/hashing Zilliqa transactions.", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "7099301a8c3cde45cf083f9f947ba6461001c927" | ||
"gitHead": "03c1bc68e13d609f6a9c951ae5fe78459d821ec4" | ||
} |
@@ -19,2 +19,4 @@ import aes from 'aes-js'; | ||
const ALGO_IDENTIFIER = 'aes-128-ctr'; | ||
/** | ||
@@ -100,3 +102,3 @@ * getDerivedKey | ||
crypto: { | ||
cipher: 'aes-128-ctr', | ||
cipher: ALGO_IDENTIFIER, | ||
cipherparams: { | ||
@@ -109,4 +111,13 @@ iv: iv.toString('hex'), | ||
mac: hashjs | ||
.sha256() | ||
.update(Buffer.concat([derivedKey.slice(16, 32), ciphertext]), 'hex') | ||
// @ts-ignore | ||
.hmac(hashjs.sha256, derivedKey, 'hex') | ||
.update( | ||
Buffer.concat([ | ||
derivedKey.slice(16, 32), | ||
ciphertext, | ||
iv, | ||
Buffer.from(ALGO_IDENTIFIER), | ||
]), | ||
'hex', | ||
) | ||
.digest('hex'), | ||
@@ -143,4 +154,13 @@ }, | ||
const mac = hashjs | ||
.sha256() | ||
.update(Buffer.concat([derivedKey.slice(16, 32), ciphertext]), 'hex') | ||
// @ts-ignore | ||
.hmac(hashjs.sha256, derivedKey, 'hex') | ||
.update( | ||
Buffer.concat([ | ||
derivedKey.slice(16, 32), | ||
ciphertext, | ||
iv, | ||
Buffer.from(ALGO_IDENTIFIER), | ||
]), | ||
'hex', | ||
) | ||
.digest('hex'); | ||
@@ -147,0 +167,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4917290
44371