Socket
Socket
Sign inDemoInstall

@pedrouid/iso-crypto

Package Overview
Dependencies
5
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

22

dist/cjs/lib/node.js

@@ -11,9 +11,9 @@ "use strict";

function nodeAesEncrypt(iv, key, data) {
const cipher = crypto_1.default.createCipheriv(constants_1.AES_NODE_ALGO, key, iv);
return enc_utils_1.bufferToArray(enc_utils_1.concatBuffers(cipher.update(data), cipher.final()));
const cipher = crypto_1.default.createCipheriv(constants_1.AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return enc_utils_1.bufferToArray(enc_utils_1.concatBuffers(cipher.update(Buffer.from(data)), cipher.final()));
}
exports.nodeAesEncrypt = nodeAesEncrypt;
function nodeAesDecrypt(iv, key, data) {
const decipher = crypto_1.default.createDecipheriv(constants_1.AES_NODE_ALGO, key, iv);
return enc_utils_1.bufferToArray(enc_utils_1.concatBuffers(decipher.update(data), decipher.final()));
const decipher = crypto_1.default.createDecipheriv(constants_1.AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return enc_utils_1.bufferToArray(enc_utils_1.concatBuffers(decipher.update(Buffer.from(data)), decipher.final()));
}

@@ -23,4 +23,4 @@ exports.nodeAesDecrypt = nodeAesDecrypt;

const buf = crypto_1.default
.createHmac(constants_1.HMAC_NODE_ALGO, new Uint8Array(key))
.update(data)
.createHmac(constants_1.HMAC_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();

@@ -32,4 +32,4 @@ return enc_utils_1.bufferToArray(buf);

const buf = crypto_1.default
.createHmac(constants_1.SHA512_NODE_ALGO, new Uint8Array(key))
.update(data)
.createHmac(constants_1.SHA512_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();

@@ -42,3 +42,3 @@ return enc_utils_1.bufferToArray(buf);

.createHash(constants_1.SHA256_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -51,3 +51,3 @@ return enc_utils_1.bufferToArray(buf);

.createHash(constants_1.SHA512_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -60,3 +60,3 @@ return enc_utils_1.bufferToArray(buf);

.createHash(constants_1.RIPEMD160_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -63,0 +63,0 @@ return enc_utils_1.bufferToArray(buf);

@@ -5,13 +5,13 @@ import crypto from 'crypto';

export function nodeAesEncrypt(iv, key, data) {
const cipher = crypto.createCipheriv(AES_NODE_ALGO, key, iv);
return bufferToArray(concatBuffers(cipher.update(data), cipher.final()));
const cipher = crypto.createCipheriv(AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return bufferToArray(concatBuffers(cipher.update(Buffer.from(data)), cipher.final()));
}
export function nodeAesDecrypt(iv, key, data) {
const decipher = crypto.createDecipheriv(AES_NODE_ALGO, key, iv);
return bufferToArray(concatBuffers(decipher.update(data), decipher.final()));
const decipher = crypto.createDecipheriv(AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return bufferToArray(concatBuffers(decipher.update(Buffer.from(data)), decipher.final()));
}
export function nodeHmacSha256Sign(key, data) {
const buf = crypto
.createHmac(HMAC_NODE_ALGO, new Uint8Array(key))
.update(data)
.createHmac(HMAC_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();

@@ -22,4 +22,4 @@ return bufferToArray(buf);

const buf = crypto
.createHmac(SHA512_NODE_ALGO, new Uint8Array(key))
.update(data)
.createHmac(SHA512_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();

@@ -31,3 +31,3 @@ return bufferToArray(buf);

.createHash(SHA256_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -39,3 +39,3 @@ return bufferToArray(buf);

.createHash(SHA512_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -47,3 +47,3 @@ return bufferToArray(buf);

.createHash(RIPEMD160_NODE_ALGO)
.update(data)
.update(Buffer.from(data))
.digest();

@@ -50,0 +50,0 @@ return bufferToArray(buf);

{
"name": "@pedrouid/iso-crypto",
"description": "Isomorphic Cryptography Library for AES, HMAC and SHA2",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"author": "Pedro Gomes <github.com/pedrouid>",

@@ -6,0 +6,0 @@ "license": "MIT",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc