Comparing version
{ | ||
"name": "crypto-js", | ||
"version": "3.1.8", | ||
"version": "3.3.0", | ||
"description": "JavaScript library of crypto standards.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,9 +0,9 @@ | ||
;(function (root, factory) { | ||
;(function (root, factory, undef) { | ||
if (typeof exports === "object") { | ||
// CommonJS | ||
module.exports = exports = factory(require("./core")); | ||
module.exports = exports = factory(require("./core"), require("./evpkdf")); | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
// AMD | ||
define(["./core"], factory); | ||
define(["./core", "./evpkdf"], factory); | ||
} | ||
@@ -469,7 +469,12 @@ else { | ||
var modeCreator = mode.createDecryptor; | ||
// Keep at least one block in the buffer for unpadding | ||
this._minBufferSize = 1; | ||
} | ||
this._mode = modeCreator.call(mode, this, iv && iv.words); | ||
if (this._mode && this._mode.__creator == modeCreator) { | ||
this._mode.init(this, iv && iv.words); | ||
} else { | ||
this._mode = modeCreator.call(mode, this, iv && iv.words); | ||
this._mode.__creator = modeCreator; | ||
} | ||
}, | ||
@@ -476,0 +481,0 @@ |
{ | ||
"name": "crypto-js", | ||
"version": "3.1.8", | ||
"version": "3.3.0", | ||
"description": "JavaScript library of crypto standards.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# crypto-js | ||
# crypto-js [](https://travis-ci.org/brix/crypto-js) | ||
@@ -18,2 +18,14 @@ JavaScript library of crypto standards. | ||
ES6 import for typical API call signing use case: | ||
```javascript | ||
import sha256 from 'crypto-js/sha256'; | ||
import hmacSHA512 from 'crypto-js/hmac-sha512'; | ||
import Base64 from 'crypto-js/enc-base64'; | ||
const message, nonce, path, privateKey; // ... | ||
const hashDigest = sha256(nonce + message); | ||
const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey)); | ||
``` | ||
Modular include: | ||
@@ -93,3 +105,3 @@ | ||
See: https://code.google.com/p/crypto-js | ||
See: https://cryptojs.gitbook.io/docs/ | ||
@@ -104,9 +116,9 @@ ### AES Encryption | ||
// Encrypt | ||
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123'); | ||
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString(); | ||
// Decrypt | ||
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123'); | ||
var plaintext = bytes.toString(CryptoJS.enc.Utf8); | ||
var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); | ||
var originalText = bytes.toString(CryptoJS.enc.Utf8); | ||
console.log(plaintext); | ||
console.log(originalText); // 'my message' | ||
``` | ||
@@ -122,9 +134,9 @@ | ||
// Encrypt | ||
var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123'); | ||
var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString(); | ||
// Decrypt | ||
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123'); | ||
var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); | ||
var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); | ||
console.log(decryptedData); | ||
console.log(decryptedData); // [{id: 1}, {id: 2}] | ||
``` | ||
@@ -203,1 +215,32 @@ | ||
- ```crypto-js/pad-nopadding``` | ||
## Release notes | ||
### 3.3.0 | ||
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. | ||
### 3.2.1 | ||
The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved. | ||
### 3.2.0 | ||
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! | ||
### 3.1.x | ||
The `3.1.x` are based on the original CryptoJS, wrapped in CommonJS modules. | ||
Sorry, the diff of this file is too big to display
430350
0.49%11202
0.09%242
21.61%