@@ -30,7 +30,7 @@ export class Cipher extends BufferedBlockAlgorithm {
30
30
*
31
31
* @example
32
32
*
33
- * const cipher = CryptoJS.algo.AES.create (
33
+ * const cipher = new Cipher (
34
34
* CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }
35
35
* );
36
36
*/
@@ -70,7 +70,7 @@ export class Cipher extends BufferedBlockAlgorithm {
70
70
* const cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
71
71
*/
72
72
static createEncryptor ( key , cfg ) {
73
- return this . create ( this . _ENC_XFORM_MODE , key , cfg ) ;
73
+ return new this ( this . _ENC_XFORM_MODE , key , cfg ) ;
74
74
}
75
75
76
76
/**
@@ -88,7 +88,7 @@ export class Cipher extends BufferedBlockAlgorithm {
88
88
* const cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
89
89
*/
90
90
static createDecryptor ( key , cfg ) {
91
- return this . create ( this . _DEC_XFORM_MODE , key , cfg ) ;
91
+ return new this ( this . _DEC_XFORM_MODE , key , cfg ) ;
92
92
}
93
93
94
94
/**
@@ -221,7 +221,7 @@ export class BlockCipherMode extends Base {
221
221
*
222
222
* @example
223
223
*
224
- * const mode = CryptoJS.mode.CBC.Encryptor.create (cipher, iv.words);
224
+ * const mode = new BlockCipherMode (cipher, iv.words);
225
225
*/
226
226
constructor ( cipher , iv ) {
227
227
super ( ) ;
@@ -243,7 +243,7 @@ export class BlockCipherMode extends Base {
243
243
* const mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
244
244
*/
245
245
static createEncryptor ( cipher , iv ) {
246
- return this . Encryptor . create ( cipher , iv ) ;
246
+ return new this . Encryptor ( cipher , iv ) ;
247
247
}
248
248
249
249
/**
@@ -259,7 +259,7 @@ export class BlockCipherMode extends Base {
259
259
* const mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
260
260
*/
261
261
static createDecryptor ( cipher , iv ) {
262
- return this . Decryptor . create ( cipher , iv ) ;
262
+ return new this . Decryptor ( cipher , iv ) ;
263
263
}
264
264
}
265
265
@@ -390,7 +390,7 @@ export const Pkcs7 = {
390
390
for ( let i = 0 ; i < nPaddingBytes ; i += 4 ) {
391
391
paddingWords . push ( paddingWord ) ;
392
392
}
393
- const padding = WordArray . create ( paddingWords , nPaddingBytes ) ;
393
+ const padding = new WordArray ( paddingWords , nPaddingBytes ) ;
394
394
395
395
// Add padding
396
396
data . concat ( padding ) ;
@@ -524,7 +524,7 @@ export class CipherParams extends Base {
524
524
*
525
525
* @example
526
526
*
527
- * var cipherParams = CryptoJS.lib. CipherParams.create ({
527
+ * let cipherParams =new CipherParams({
528
528
* ciphertext: ciphertextWordArray,
529
529
* key: keyWordArray,
530
530
* iv: ivWordArray,
@@ -553,9 +553,9 @@ export class CipherParams extends Base {
553
553
*
554
554
* @example
555
555
*
556
- * var string = cipherParams + '';
557
- * var string = cipherParams.toString();
558
- * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
556
+ * let string = cipherParams + '';
557
+ * let string = cipherParams.toString();
558
+ * let string = cipherParams.toString(CryptoJS.format.OpenSSL);
559
559
*/
560
560
toString ( formatter ) {
561
561
return ( formatter || this . formatter ) . stringify ( this ) ;
@@ -577,7 +577,7 @@ export const OpenSSLFormatter = {
577
577
*
578
578
* @example
579
579
*
580
- * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
580
+ * let openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
581
581
*/
582
582
stringify ( cipherParams ) {
583
583
let wordArray ;
@@ -590,7 +590,7 @@ export const OpenSSLFormatter = {
590
590
591
591
// Format
592
592
if ( salt ) {
593
- wordArray = WordArray . create ( [ 0x53616c74 , 0x65645f5f ] ) . concat ( salt ) . concat ( ciphertext ) ;
593
+ wordArray = new WordArray ( [ 0x53616c74 , 0x65645f5f ] ) . concat ( salt ) . concat ( ciphertext ) ;
594
594
} else {
595
595
wordArray = ciphertext ;
596
596
}
@@ -609,7 +609,7 @@ export const OpenSSLFormatter = {
609
609
*
610
610
* @example
611
611
*
612
- * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
612
+ * let cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
613
613
*/
614
614
parse ( openSSLStr ) {
615
615
let salt ;
@@ -623,14 +623,14 @@ export const OpenSSLFormatter = {
623
623
// Test for salt
624
624
if ( ciphertextWords [ 0 ] === 0x53616c74 && ciphertextWords [ 1 ] === 0x65645f5f ) {
625
625
// Extract salt
626
- salt = WordArray . create ( ciphertextWords . slice ( 2 , 4 ) ) ;
626
+ salt = new WordArray ( ciphertextWords . slice ( 2 , 4 ) ) ;
627
627
628
628
// Remove salt from ciphertext
629
629
ciphertextWords . splice ( 0 , 4 ) ;
630
630
ciphertext . sigBytes -= 16 ;
631
631
}
632
632
633
- return CipherParams . create ( {
633
+ return new CipherParams ( {
634
634
ciphertext,
635
635
salt
636
636
} ) ;
@@ -655,11 +655,11 @@ export class SerializableCipher extends Base {
655
655
*
656
656
* @example
657
657
*
658
- * var ciphertextParams = CryptoJS.lib.SerializableCipher
658
+ * let ciphertextParams = CryptoJS.lib.SerializableCipher
659
659
* .encrypt(CryptoJS.algo.AES, message, key);
660
- * var ciphertextParams = CryptoJS.lib.SerializableCipher
660
+ * let ciphertextParams = CryptoJS.lib.SerializableCipher
661
661
* .encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
662
- * var ciphertextParams = CryptoJS.lib.SerializableCipher
662
+ * let ciphertextParams = CryptoJS.lib.SerializableCipher
663
663
* .encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
664
664
*/
665
665
static encrypt ( cipher , message , key , cfg ) {
@@ -674,7 +674,7 @@ export class SerializableCipher extends Base {
674
674
const cipherCfg = encryptor . cfg ;
675
675
676
676
// Create and return serializable cipher params
677
- return CipherParams . create ( {
677
+ return new CipherParams ( {
678
678
ciphertext,
679
679
key,
680
680
iv : cipherCfg . iv ,
@@ -700,10 +700,10 @@ export class SerializableCipher extends Base {
700
700
*
701
701
* @example
702
702
*
703
- * var plaintext = CryptoJS.lib.SerializableCipher
703
+ * let plaintext = CryptoJS.lib.SerializableCipher
704
704
* .decrypt(CryptoJS.algo.AES, formattedCiphertext, key,
705
705
* { iv: iv, format: CryptoJS.format.OpenSSL });
706
- * var plaintext = CryptoJS.lib.SerializableCipher
706
+ * let plaintext = CryptoJS.lib.SerializableCipher
707
707
* .decrypt(CryptoJS.algo.AES, ciphertextParams, key,
708
708
* { iv: iv, format: CryptoJS.format.OpenSSL });
709
709
*/
@@ -735,7 +735,7 @@ export class SerializableCipher extends Base {
735
735
*
736
736
* @example
737
737
*
738
- * var ciphertextParams = CryptoJS.lib.SerializableCipher
738
+ * let ciphertextParams = CryptoJS.lib.SerializableCipher
739
739
* ._parse(ciphertextStringOrParams, format);
740
740
*/
741
741
static _parse ( ciphertext , format ) {
@@ -778,8 +778,8 @@ export const OpenSSLKdf = {
778
778
*
779
779
* @example
780
780
*
781
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
782
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
781
+ * let derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
782
+ * let derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
783
783
*/
784
784
execute ( password , keySize , ivSize , salt ) {
785
785
let _salt = salt ;
@@ -790,16 +790,16 @@ export const OpenSSLKdf = {
790
790
}
791
791
792
792
// Derive key and IV
793
- const key = EvpKDFAlgo . create ( {
793
+ const key = new EvpKDFAlgo ( {
794
794
keySize : keySize + ivSize
795
795
} ) . compute ( password , _salt ) ;
796
796
797
797
// Separate key and IV
798
- const iv = WordArray . create ( key . words . slice ( keySize ) , ivSize * 4 ) ;
798
+ const iv = new WordArray ( key . words . slice ( keySize ) , ivSize * 4 ) ;
799
799
key . sigBytes = keySize * 4 ;
800
800
801
801
// Return params
802
- return CipherParams . create ( {
802
+ return new CipherParams ( {
803
803
key,
804
804
iv,
805
805
salt : _salt
@@ -826,9 +826,9 @@ export class PasswordBasedCipher extends SerializableCipher {
826
826
*
827
827
* @example
828
828
*
829
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
829
+ * let ciphertextParams = CryptoJS.lib.PasswordBasedCipher
830
830
* .encrypt(CryptoJS.algo.AES, message, 'password');
831
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
831
+ * let ciphertextParams = CryptoJS.lib.PasswordBasedCipher
832
832
* .encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
833
833
*/
834
834
static encrypt ( cipher , message , password , cfg ) {
@@ -865,10 +865,10 @@ export class PasswordBasedCipher extends SerializableCipher {
865
865
*
866
866
* @example
867
867
*
868
- * var plaintext = CryptoJS.lib.PasswordBasedCipher
868
+ * let plaintext = CryptoJS.lib.PasswordBasedCipher
869
869
* .decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password',
870
870
* { format: CryptoJS.format.OpenSSL });
871
- * var plaintext = CryptoJS.lib.PasswordBasedCipher
871
+ * let plaintext = CryptoJS.lib.PasswordBasedCipher
872
872
* .decrypt(CryptoJS.algo.AES, ciphertextParams, 'password',
873
873
* { format: CryptoJS.format.OpenSSL });
874
874
*/
0 commit comments