Gathering detailed insights and metrics for crypto-js
Gathering detailed insights and metrics for crypto-js
Gathering detailed insights and metrics for crypto-js
Gathering detailed insights and metrics for crypto-js
JavaScript library of crypto standards.
npm install crypto-js
100
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
15,885 Stars
184 Commits
2,394 Forks
258 Watching
5 Branches
24 Contributors
Updated on 29 Nov 2024
Minified
Minified + Gzipped
JavaScript (93.77%)
HTML (6.23%)
Cumulative downloads
Total Downloads
Last day
-19.5%
1,200,882
Compared to previous day
Last week
-3.4%
7,522,475
Compared to previous week
Last month
2.2%
32,764,698
Compared to previous month
Last year
22.1%
350,075,812
Compared to previous year
JavaScript library of crypto standards.
Active development of CryptoJS has been discontinued. This library is no longer maintained.
Nowadays, NodeJS and modern browsers have a native Crypto
module. The latest version of CryptoJS already uses the native Crypto module for random number generation, since Math.random()
is not crypto-safe. Further development of CryptoJS would result in it only being a wrapper of native Crypto. Therefore, development and maintenance has been discontinued, it is time to go for the native crypto
module.
Requirements:
1npm install crypto-js
ES6 import for typical API call signing use case:
1import sha256 from 'crypto-js/sha256'; 2import hmacSHA512 from 'crypto-js/hmac-sha512'; 3import Base64 from 'crypto-js/enc-base64'; 4 5const message, nonce, path, privateKey; // ... 6const hashDigest = sha256(nonce + message); 7const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
Modular include:
1var AES = require("crypto-js/aes"); 2var SHA256 = require("crypto-js/sha256"); 3... 4console.log(SHA256("Message"));
Including all libraries, for access to extra methods:
1var CryptoJS = require("crypto-js"); 2console.log(CryptoJS.HmacSHA1("Message", "Key"));
Requirements:
1bower install crypto-js
Modular include:
1require.config({ 2 packages: [ 3 { 4 name: 'crypto-js', 5 location: 'path-to/bower_components/crypto-js', 6 main: 'index' 7 } 8 ] 9}); 10 11require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) { 12 console.log(SHA256("Message")); 13});
Including all libraries, for access to extra methods:
1// Above-mentioned will work or use this simple form 2require.config({ 3 paths: { 4 'crypto-js': 'path-to/bower_components/crypto-js/crypto-js' 5 } 6}); 7 8require(["crypto-js"], function (CryptoJS) { 9 console.log(CryptoJS.HmacSHA1("Message", "Key")); 10});
1<script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script> 2<script type="text/javascript"> 3 var encrypted = CryptoJS.AES(...); 4 var encrypted = CryptoJS.SHA256(...); 5</script>
See: https://cryptojs.gitbook.io/docs/
1var CryptoJS = require("crypto-js"); 2 3// Encrypt 4var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString(); 5 6// Decrypt 7var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); 8var originalText = bytes.toString(CryptoJS.enc.Utf8); 9 10console.log(originalText); // 'my message'
1var CryptoJS = require("crypto-js"); 2 3var data = [{id: 1}, {id: 2}] 4 5// Encrypt 6var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString(); 7 8// Decrypt 9var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); 10var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); 11 12console.log(decryptedData); // [{id: 1}, {id: 2}]
crypto-js/core
crypto-js/x64-core
crypto-js/lib-typedarrays
crypto-js/md5
crypto-js/sha1
crypto-js/sha256
crypto-js/sha224
crypto-js/sha512
crypto-js/sha384
crypto-js/sha3
crypto-js/ripemd160
crypto-js/hmac-md5
crypto-js/hmac-sha1
crypto-js/hmac-sha256
crypto-js/hmac-sha224
crypto-js/hmac-sha512
crypto-js/hmac-sha384
crypto-js/hmac-sha3
crypto-js/hmac-ripemd160
crypto-js/pbkdf2
crypto-js/aes
crypto-js/tripledes
crypto-js/rc4
crypto-js/rabbit
crypto-js/rabbit-legacy
crypto-js/evpkdf
crypto-js/format-openssl
crypto-js/format-hex
crypto-js/enc-latin1
crypto-js/enc-utf8
crypto-js/enc-hex
crypto-js/enc-utf16
crypto-js/enc-base64
crypto-js/mode-cfb
crypto-js/mode-ctr
crypto-js/mode-ctr-gladman
crypto-js/mode-ofb
crypto-js/mode-ecb
crypto-js/pad-pkcs7
crypto-js/pad-ansix923
crypto-js/pad-iso10126
crypto-js/pad-iso97971
crypto-js/pad-zeropadding
crypto-js/pad-nopadding
Change default hash algorithm and iteration's for PBKDF2 to prevent weak security by using the default configuration.
Custom KDF Hasher
Blowfish support
Fix module order in bundled release.
Include the browser field in the released package.json.
Added url safe variant of base64 encoding. 357
Avoid webpack to add crypto-browser package. 364
This is an update including breaking changes for some environments.
In this version Math.random()
has been replaced by the random methods of the native crypto module.
For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native.
Rollback, 3.3.0
is the same as 3.1.9-1
.
The move of using native secure crypto module will be shifted to a new 4.x.x
version. As it is a breaking change the impact is too big for a minor release.
The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved.
In this version Math.random()
has been replaced by the random methods of the native crypto module.
For this reason CryptoJS might does not run in some JavaScript environments without native crypto module. Such as IE 10 or before.
If it's absolute required to run CryptoJS in such an environment, stay with 3.1.x
version. Encrypting and decrypting stays compatible. But keep in mind 3.1.x
versions still use Math.random()
which is cryptographically not secure, as it's not random enough.
This version came along with CRITICAL
BUG
.
DO NOT USE THIS VERSION! Please, go for a newer version!
The 3.1.x
are based on the original CryptoJS, wrapped in CommonJS modules.
The latest stable version of the package.
Stable Version
1
9.1/10
Summary
crypto-js PBKDF2 1,000 times weaker than specified in 1993 and 1.3M times weaker than current standard
Affected Versions
< 4.2.0
Patched Versions
4.2.0
1
5.3/10
Summary
crypto-js uses insecure random numbers
Affected Versions
< 3.2.1
Patched Versions
3.2.1
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 6/24 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More