diff --git a/crypto-js/crypto-js.d.ts b/crypto-js/crypto-js.d.ts
index 0f02514027..cde0abd9b9 100644
--- a/crypto-js/crypto-js.d.ts
+++ b/crypto-js/crypto-js.d.ts
@@ -1,67 +1,528 @@
-// Type definitions for crypto-js v3.1.3
+// Type definitions for crypto-js v3.1.5
// Project: https://github.com/evanvosberg/crypto-js
-// Definitions by: Michael Zabka
+// Definitions by: Michael Zabka , Jason Turner
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-declare module CryptoJS {
- type Hash = (message: string, key?: string, ...options: any[]) => string;
+declare module CryptoJSLocal{
+ module lib{
+ interface Base{
+ extend(overrides: Object): Object
+ init(...args: any[]): void
+ //arguments of create() is same as init(). This is true for all subclasses
+ create(...args: any[]): Base
+ mixIn(properties: Object): void
+ clone(): Base
+ }
- export interface Hashes {
- MD5: Hash;
- SHA1: Hash;
- SHA256: Hash;
- SHA224: Hash;
- SHA512: Hash;
- SHA384: Hash;
- SHA3: Hash;
- RIPEMD160: Hash;
- HmacMD5: Hash;
- HmacSHA1: Hash;
- HmacSHA256: Hash;
- HmacSHA224: Hash;
- HmacSHA512: Hash;
- HmacSHA384: Hash;
- HmacSHA3: Hash;
- HmacRIPEMD160: Hash;
- PBKDF2: Hash;
- AES: Hash;
- TripleDES: Hash;
- RC4: Hash;
- Rabbit: Hash;
- RabbitLegacy: Hash;
- EvpKDF: Hash;
- format: {
- OpenSSL: Hash;
- Hex: Hash;
- };
- enc: {
- Latin1: Hash;
- Utf8: Hash;
- Hex: Hash;
- Utf16: Hash;
- Base64: Hash;
- };
- mode: {
- CFB: Hash;
- CTR: Hash;
- CTRGladman: Hash;
- OFB: Hash;
- ECB: Hash;
- };
- pad: {
- Pkcs7: Hash;
- Ansix923: Hash;
- Iso10126: Hash;
- Iso97971: Hash;
- ZeroPadding: Hash;
- NoPadding: Hash;
- };
- }
+ interface WordArray extends Base{
+ words: number[]
+ sigBytes: number
+ init(words?: number[], sigBytes?: number): void
+ create(words?: number[], sigBytes?: number): WordArray
- export var hashes: Hashes;
+ init(typedArray: ArrayBuffer): void
+ init(typedArray: Int8Array): void
+
+ //Because TypeScript uses a structural type system then we don't need (& can't)
+ //declare oveload function init, create for the following type (same as Int8Array):
+ //then Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array
+ //Note also: Uint8ClampedArray is not defined in lib.d.ts & not supported in IE
+ //@see http://compatibility.shwups-cms.ch/en/home?&property=Uint8ClampedArray
+
+ create(typedArray: ArrayBuffer): WordArray
+ create(typedArray: Int8Array): WordArray
+
+ toString(encoder?: enc.IEncoder): string
+ concat(wordArray: WordArray): WordArray
+ clamp(): void
+ clone(): WordArray
+ random(nBytes: number): WordArray
+ }
+
+ interface BufferedBlockAlgorithm extends Base{
+ reset(): void
+ clone(): BufferedBlockAlgorithm
+ }
+
+ //tparam C - Configuration type
+ interface IHasher extends BufferedBlockAlgorithm{
+ cfg: C
+ init(cfg?: C): void
+ create(cfg?: C): IHasher
+
+ update(messageUpdate: string): Hasher
+ update(messageUpdate: WordArray): Hasher
+
+ finalize(messageUpdate?: string): WordArray
+ finalize(messageUpdate?: WordArray): WordArray
+
+ blockSize: number
+
+ _createHelper(hasher: Hasher): IHasherHelper
+ _createHmacHelper(hasher: Hasher): IHasherHmacHelper
+
+ clone(): IHasher
+ }
+ interface Hasher extends IHasher