artjomb / cryptojs-extension Goto Github PK
View Code? Open in Web Editor NEWExtensions for CryptoJS containing AES-CMAC, AES-SIV and AES-EAX implementations
License: MIT License
Extensions for CryptoJS containing AES-CMAC, AES-SIV and AES-EAX implementations
License: MIT License
I want use it like this picture.
function test3() {
let vec = {
key: "8395FCF1E95BEBD697BD010BC766AAC3",
nonce: "22E7ADD93CFC6393C57EC0B3C17D6B44",
header: "126735FCC320D25A",
msg: "CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7",
msg2: "6CF36720872B8513F6EAB1A8A44438D5EF11",
ct: "CB8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E"
};
let keyBytes = CryptoJS.enc.Hex.parse(vec.key),
msgBytes = CryptoJS.enc.Hex.parse(vec.msg),
msgBytes2 = CryptoJS.enc.Hex.parse(vec.msg2),
nonceBytes = CryptoJS.enc.Hex.parse(vec.nonce),
headerBytes = CryptoJS.enc.Hex.parse(vec.header);
let eax = CryptoJS.EAX.create(keyBytes);
eax.encrypt(nonceBytes, [headerBytes]);
eax.update(msgBytes);
eax.update(msgBytes2);
let et = eax.finalize();
// console.log(et.toString())
console.log("msgB1 ",vec.msg.toLowerCase(), "ciphertext match ["+"]");
}.
I have use this command npm i crypto-js
to install the package. Package install successfully. I have import all libraries but I am unable to access AES.encrypt()
and AES.decrypt()
method.
Expected Behavior: Should find AES.encrypt()
and AES.decrypt()
method.
Actual Behavior: Cannot find AES.encrypt()
and AES.decrypt()
method.
Platform Used:
crypto-js version: 4.1.1
Angular version: 14.2.0
Node Version: 18.12.1
The SIV-mode is a 2-pass algorithm. It is a challenge to design an intuitive way to use it in a streaming fashion. The underlying primitives like AES-CMAC and AES-CTR are already implemented in a streaming way (the have update(data)
functions).
You mention in the README
that the library won't work in Node.js -- is this still true? What's the problem, and what would it take to address it? I'd be very interested in getting AES-SIV running in Node, unless you're aware of alternative solutions.
typeof obj.words === "array"
This will never be true, since typeof [1, 2]
is object
.
Perhaps we shall change it into Array.isArray
?
I was just conducting some tests and noted that any value for the tagLength parameter leads to a 16 byte tag in the encrypted byte array. Is it possible that some truncation operation is missing? Thanks!
proposed fix for successful decryption: src/eax.c, 109:
if (ext.equals(ext.leftmostBytes(self._tag, self._tagLen), self._buf)) { ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.