Update CryptoJS-definition to include lib.WordArray.create and allow the output as input to any Hash (#20072)

* Update CryptoJS-definition to include lib.WordArray.create and allow the output as input to any Hash

* fixed indentation
This commit is contained in:
Marius N. Nicolaysen
2017-10-02 10:37:30 -07:00
committed by Ryan Cavanaugh
parent 934989143e
commit 8055d9b2b1
2 changed files with 14 additions and 1 deletions
+4
View File
@@ -11,6 +11,10 @@ wordArray = CryptoJS.SHA1('some message', 'some key', { any: true });
wordArray = CryptoJS.format.OpenSSL('some message');
wordArray = CryptoJS.format.OpenSSL('some message', 'some key');
var FR = new FileReader();
FR.onloadend = () => {
var hash = CryptoJS.SHA1(CryptoJS.lib.WordArray.create(FR.result)).toString()
}
// Ciphers
var encrypted: CryptoJS.WordArray;
+10 -1
View File
@@ -8,7 +8,7 @@ export as namespace CryptoJS;
declare var CryptoJS: CryptoJS.Hashes;
declare namespace CryptoJS {
type Hash = (message: string, key?: string, ...options: any[]) => WordArray;
type Hash = (message: string | LibWordArray, key?: string, ...options: any[]) => WordArray;
interface Cipher {
encrypt(message: string, secretPassphrase: string, option?: CipherOption): WordArray;
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string, option?: CipherOption): DecryptedMessage;
@@ -25,6 +25,10 @@ declare namespace CryptoJS {
process(messagePart: string): string;
finalize(): string;
}
interface LibWordArray {
sigBytes: number,
words: number[],
}
export interface WordArray {
iv: string;
salt: string;
@@ -97,6 +101,11 @@ declare namespace CryptoJS {
Utf16LE: Encoder;
Base64: Encoder;
};
lib: {
WordArray: {
create: (v: any) => LibWordArray;
};
};
mode: {
CBC: Mode;
CFB: Mode;