@types/crypto-js

  • Version 4.2.2
  • Published
  • 60.4 kB
  • No dependencies
  • MIT license

Install

npm i @types/crypto-js
yarn add @types/crypto-js
pnpm add @types/crypto-js

Overview

TypeScript definitions for crypto-js

Index

Variables

variable AES

const AES: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);

variable Blowfish

const Blowfish: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg); var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);

variable DES

const DES: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);

variable HmacMD5

const HmacMD5: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMA'C.

    Example 1

    var hmac = CryptoJS.HmacMD5(message, key);

variable HmacRIPEMD160

const HmacRIPEMD160: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacRIPEMD160(message, key);

variable HmacSHA1

const HmacSHA1: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA1(message, key);

variable HmacSHA224

const HmacSHA224: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA224(message, key);

variable HmacSHA256

const HmacSHA256: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA256(message, key);

variable HmacSHA3

const HmacSHA3: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA3(message, key);

variable HmacSHA384

const HmacSHA384: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA384(message, key);

variable HmacSHA512

const HmacSHA512: HmacHasherHelper;
  • Shortcut function to the HMAC's object interface.

    Parameter message

    The message to hash.

    Parameter key

    The secret key.

    The HMAC.

    Example 1

    var hmac = CryptoJS.HmacSHA512(message, key);

variable MD5

const MD5: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.MD5('message'); var hash = CryptoJS.MD5(wordArray);

variable Rabbit

const Rabbit: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);

variable RabbitLegacy

const RabbitLegacy: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);

variable RC4

const RC4: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);

variable RC4Drop

const RC4Drop: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);

variable RIPEMD160

const RIPEMD160: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.RIPEMD160('message'); var hash = CryptoJS.RIPEMD160(wordArray);

variable SHA1

const SHA1: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA1('message'); var hash = CryptoJS.SHA1(wordArray);

variable SHA224

const SHA224: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA224('message'); var hash = CryptoJS.SHA224(wordArray);

variable SHA256

const SHA256: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA256('message'); var hash = CryptoJS.SHA256(wordArray);

variable SHA3

const SHA3: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA3('message'); var hash = CryptoJS.SHA3(wordArray);

variable SHA384

const SHA384: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA384('message'); var hash = CryptoJS.SHA384(wordArray);

variable SHA512

const SHA512: HasherHelper;
  • Shortcut function to the hasher's object interface.

    Parameter message

    The message to hash.

    The hash.

    Example 1

    var hash = CryptoJS.SHA512('message'); var hash = CryptoJS.SHA512(wordArray);

variable TripleDES

const TripleDES: CipherHelper;
  • Shortcut functions to the cipher's object interface.

    Example 1

    var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);

Functions

function EvpKDF

EvpKDF: (
password: WordArray | string,
salt: WordArray | string,
cfg?: { keySize: number; hasher?: HasherStatic | undefined; iterations: number }
) => WordArray;
  • Derives a key from a password.

    Parameter password

    The password.

    Parameter salt

    A salt.

    Parameter cfg

    (Optional) The configuration options to use for this computation.

    The derived key.

    Example 1

    var key = CryptoJS.EvpKDF(password, salt); var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });

function PBKDF2

PBKDF2: (
password: WordArray | string,
salt: WordArray | string,
cfg?: KDFOption
) => WordArray;
  • Computes the Password-Based Key Derivation Function 2.

    Parameter password

    The password.

    Parameter salt

    A salt.

    Parameter cfg

    (Optional) The configuration options to use for this computation.

    The derived key.

    Example 1

    var key = CryptoJS.PBKDF2(password, salt); var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });

Namespaces

namespace algo

namespace algo {}
  • Algorithm namespace.

variable AES

const AES: CipherStatic;
  • AES block cipher algorithm.

variable DES

const DES: CipherStatic;
  • DES block cipher algorithm.

variable MD5

const MD5: HasherStatic;
  • MD5 hash algorithm.

variable Rabbit

const Rabbit: CipherStatic;
  • Rabbit stream cipher algorithm

variable RabbitLegacy

const RabbitLegacy: CipherStatic;
  • Rabbit stream cipher algorithm.

    This is a legacy version that neglected to convert the key to little-endian. This error doesn't affect the cipher's security, but it does affect its compatibility with other implementations.

variable RC4

const RC4: CipherStatic;
  • RC4 stream cipher algorithm.

variable RC4Drop

const RC4Drop: CipherStatic;
  • Modified RC4 stream cipher algorithm.

variable RIPEMD160

const RIPEMD160: HasherStatic;
  • RIPEMD160 hash algorithm.

variable SHA1

const SHA1: HasherStatic;
  • SHA-1 hash algorithm.

variable SHA224

const SHA224: HasherStatic;
  • SHA-224 hash algorithm.

variable SHA256

const SHA256: HasherStatic;
  • SHA-256 hash algorithm.

variable SHA3

const SHA3: HasherStatic;
  • SHA-3 hash algorithm.

variable SHA384

const SHA384: HasherStatic;
  • SHA-384 hash algorithm.

variable SHA512

const SHA512: HasherStatic;
  • SHA-512 hash algorithm.

variable TripleDES

const TripleDES: CipherStatic;
  • Triple-DES block cipher algorithm.

class EvpKDF

abstract class EvpKDF {}
  • This key derivation function is meant to conform with EVP_BytesToKey. www.openssl.org/docs/crypto/EVP_BytesToKey.html

method compute

compute: (password: WordArray | string, salt: WordArray) => WordArray;
  • Derives a key from a password.

    Parameter password

    The password.

    Parameter salt

    A salt.

    The derived key.

    Example 1

    var key = kdf.compute(password, salt);

method create

static create: (cfg?: {
keySize: number;
hasher?: HasherStatic | undefined;
iterations: number;
}) => EvpKDF;
  • Initializes a newly created key derivation function.

    Parameter cfg

    (Optional) The configuration options to use for the derivation.

    Example 1

    var kdf = CryptoJS.algo.EvpKDF.create(); var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });

class HMAC

abstract class HMAC {}
  • HMAC algorithm.

method create

static create: (hasher: HasherStatic, key: WordArray | string) => HMAC;
  • Initializes a newly created HMAC.

    Parameter hasher

    The hash algorithm to use.

    Parameter key

    The secret key.

    Example 1

    var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);

method finalize

finalize: (messageUpdate?: WordArray | string) => WordArray;
  • Finalizes the HMAC computation. Note that the finalize operation is effectively a destructive, read-once operation.

    Parameter messageUpdate

    (Optional) A final message update.

    The HMAC.

    Example 1

    var hmac = hmacHasher.finalize(); var hmac = hmacHasher.finalize('message'); var hmac = hmacHasher.finalize(wordArray);

method reset

reset: () => void;
  • Resets this HMAC to its initial state.

    Example 1

    hmacHasher.reset();

method update

update: (messageUpdate: WordArray | string) => this;
  • Updates this HMAC with a message.

    Parameter messageUpdate

    The message to append.

    This HMAC instance.

    Example 1

    hmacHasher.update('message'); hmacHasher.update(wordArray);

class PBKDF2

abstract class PBKDF2 {}
  • Password-Based Key Derivation Function 2 algorithm.

method compute

compute: (password: WordArray | string, salt: WordArray) => WordArray;
  • Computes the Password-Based Key Derivation Function 2.

    Parameter password

    The password.

    Parameter salt

    A salt.

    The derived key.

    Example 1

    var key = kdf.compute(password, salt);

method create

static create: (cfg?: KDFOption) => PBKDF2;
  • Initializes a newly created key derivation function.

    Parameter cfg

    (Optional) The configuration options to use for the derivation.

    Example 1

    var kdf = CryptoJS.algo.PBKDF2.create(); var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });

namespace enc

namespace enc {}
  • Encoder namespace.

variable Base64

const Base64: Encoder;
  • Base64 encoding strategy.

variable Base64url

const Base64url: Encoder;
  • Base64url encoding strategy.

variable Hex

const Hex: Encoder;
  • Hex encoding strategy.

variable Latin1

const Latin1: Encoder;
  • Latin1 encoding strategy.

variable Utf16

const Utf16: Encoder;
  • UTF-16 BE encoding strategy.

variable Utf16BE

const Utf16BE: Encoder;

    variable Utf16LE

    const Utf16LE: Encoder;
    • UTF-16 LE encoding strategy.

    variable Utf8

    const Utf8: Encoder;
    • UTF-8 encoding strategy.

    namespace format

    namespace format {}
    • Format namespace.

    variable Hex

    const Hex: Format;

      variable OpenSSL

      const OpenSSL: Format;
      • OpenSSL formatting strategy.

      namespace global

      namespace global {}

        namespace global.CryptoJS

        namespace global.CryptoJS {}

          variable AES

          const AES: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);

          variable Blowfish

          const Blowfish: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg); var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);

          variable DES

          const DES: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);

          variable HmacMD5

          const HmacMD5: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMA'C.

            Example 1

            var hmac = CryptoJS.HmacMD5(message, key);

          variable HmacRIPEMD160

          const HmacRIPEMD160: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacRIPEMD160(message, key);

          variable HmacSHA1

          const HmacSHA1: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA1(message, key);

          variable HmacSHA224

          const HmacSHA224: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA224(message, key);

          variable HmacSHA256

          const HmacSHA256: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA256(message, key);

          variable HmacSHA3

          const HmacSHA3: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA3(message, key);

          variable HmacSHA384

          const HmacSHA384: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA384(message, key);

          variable HmacSHA512

          const HmacSHA512: HmacHasherHelper;
          • Shortcut function to the HMAC's object interface.

            Parameter message

            The message to hash.

            Parameter key

            The secret key.

            The HMAC.

            Example 1

            var hmac = CryptoJS.HmacSHA512(message, key);

          variable MD5

          const MD5: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.MD5('message'); var hash = CryptoJS.MD5(wordArray);

          variable Rabbit

          const Rabbit: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);

          variable RabbitLegacy

          const RabbitLegacy: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);

          variable RC4

          const RC4: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);

          variable RC4Drop

          const RC4Drop: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);

          variable RIPEMD160

          const RIPEMD160: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.RIPEMD160('message'); var hash = CryptoJS.RIPEMD160(wordArray);

          variable SHA1

          const SHA1: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA1('message'); var hash = CryptoJS.SHA1(wordArray);

          variable SHA224

          const SHA224: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA224('message'); var hash = CryptoJS.SHA224(wordArray);

          variable SHA256

          const SHA256: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA256('message'); var hash = CryptoJS.SHA256(wordArray);

          variable SHA3

          const SHA3: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA3('message'); var hash = CryptoJS.SHA3(wordArray);

          variable SHA384

          const SHA384: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA384('message'); var hash = CryptoJS.SHA384(wordArray);

          variable SHA512

          const SHA512: HasherHelper;
          • Shortcut function to the hasher's object interface.

            Parameter message

            The message to hash.

            The hash.

            Example 1

            var hash = CryptoJS.SHA512('message'); var hash = CryptoJS.SHA512(wordArray);

          variable TripleDES

          const TripleDES: CipherHelper;
          • Shortcut functions to the cipher's object interface.

            Example 1

            var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);

          function EvpKDF

          EvpKDF: (
          password: WordArray | string,
          salt: WordArray | string,
          cfg?: { keySize: number; hasher?: HasherStatic | undefined; iterations: number }
          ) => WordArray;
          • Derives a key from a password.

            Parameter password

            The password.

            Parameter salt

            A salt.

            Parameter cfg

            (Optional) The configuration options to use for this computation.

            The derived key.

            Example 1

            var key = CryptoJS.EvpKDF(password, salt); var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });

          function PBKDF2

          PBKDF2: (
          password: WordArray | string,
          salt: WordArray | string,
          cfg?: KDFOption
          ) => WordArray;
          • Computes the Password-Based Key Derivation Function 2.

            Parameter password

            The password.

            Parameter salt

            A salt.

            Parameter cfg

            (Optional) The configuration options to use for this computation.

            The derived key.

            Example 1

            var key = CryptoJS.PBKDF2(password, salt); var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });

          namespace global.CryptoJS.algo

          namespace global.CryptoJS.algo {}
          • Algorithm namespace.

          variable AES

          const AES: CipherStatic;
          • AES block cipher algorithm.

          variable DES

          const DES: CipherStatic;
          • DES block cipher algorithm.

          variable MD5

          const MD5: HasherStatic;
          • MD5 hash algorithm.

          variable Rabbit

          const Rabbit: CipherStatic;
          • Rabbit stream cipher algorithm

          variable RabbitLegacy

          const RabbitLegacy: CipherStatic;
          • Rabbit stream cipher algorithm.

            This is a legacy version that neglected to convert the key to little-endian. This error doesn't affect the cipher's security, but it does affect its compatibility with other implementations.

          variable RC4

          const RC4: CipherStatic;
          • RC4 stream cipher algorithm.

          variable RC4Drop

          const RC4Drop: CipherStatic;
          • Modified RC4 stream cipher algorithm.

          variable RIPEMD160

          const RIPEMD160: HasherStatic;
          • RIPEMD160 hash algorithm.

          variable SHA1

          const SHA1: HasherStatic;
          • SHA-1 hash algorithm.

          variable SHA224

          const SHA224: HasherStatic;
          • SHA-224 hash algorithm.

          variable SHA256

          const SHA256: HasherStatic;
          • SHA-256 hash algorithm.

          variable SHA3

          const SHA3: HasherStatic;
          • SHA-3 hash algorithm.

          variable SHA384

          const SHA384: HasherStatic;
          • SHA-384 hash algorithm.

          variable SHA512

          const SHA512: HasherStatic;
          • SHA-512 hash algorithm.

          variable TripleDES

          const TripleDES: CipherStatic;
          • Triple-DES block cipher algorithm.

          class EvpKDF

          abstract class EvpKDF {}
          • This key derivation function is meant to conform with EVP_BytesToKey. www.openssl.org/docs/crypto/EVP_BytesToKey.html

          method compute

          compute: (password: WordArray | string, salt: WordArray) => WordArray;
          • Derives a key from a password.

            Parameter password

            The password.

            Parameter salt

            A salt.

            The derived key.

            Example 1

            var key = kdf.compute(password, salt);

          method create

          static create: (cfg?: {
          keySize: number;
          hasher?: HasherStatic | undefined;
          iterations: number;
          }) => EvpKDF;
          • Initializes a newly created key derivation function.

            Parameter cfg

            (Optional) The configuration options to use for the derivation.

            Example 1

            var kdf = CryptoJS.algo.EvpKDF.create(); var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });

          class HMAC

          abstract class HMAC {}
          • HMAC algorithm.

          method create

          static create: (hasher: HasherStatic, key: WordArray | string) => HMAC;
          • Initializes a newly created HMAC.

            Parameter hasher

            The hash algorithm to use.

            Parameter key

            The secret key.

            Example 1

            var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);

          method finalize

          finalize: (messageUpdate?: WordArray | string) => WordArray;
          • Finalizes the HMAC computation. Note that the finalize operation is effectively a destructive, read-once operation.

            Parameter messageUpdate

            (Optional) A final message update.

            The HMAC.

            Example 1

            var hmac = hmacHasher.finalize(); var hmac = hmacHasher.finalize('message'); var hmac = hmacHasher.finalize(wordArray);

          method reset

          reset: () => void;
          • Resets this HMAC to its initial state.

            Example 1

            hmacHasher.reset();

          method update

          update: (messageUpdate: WordArray | string) => this;
          • Updates this HMAC with a message.

            Parameter messageUpdate

            The message to append.

            This HMAC instance.

            Example 1

            hmacHasher.update('message'); hmacHasher.update(wordArray);

          class PBKDF2

          abstract class PBKDF2 {}
          • Password-Based Key Derivation Function 2 algorithm.

          method compute

          compute: (password: WordArray | string, salt: WordArray) => WordArray;
          • Computes the Password-Based Key Derivation Function 2.

            Parameter password

            The password.

            Parameter salt

            A salt.

            The derived key.

            Example 1

            var key = kdf.compute(password, salt);

          method create

          static create: (cfg?: KDFOption) => PBKDF2;
          • Initializes a newly created key derivation function.

            Parameter cfg

            (Optional) The configuration options to use for the derivation.

            Example 1

            var kdf = CryptoJS.algo.PBKDF2.create(); var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });

          namespace global.CryptoJS.enc

          namespace global.CryptoJS.enc {}
          • Encoder namespace.

          variable Base64

          const Base64: Encoder;
          • Base64 encoding strategy.

          variable Base64url

          const Base64url: Encoder;
          • Base64url encoding strategy.

          variable Hex

          const Hex: Encoder;
          • Hex encoding strategy.

          variable Latin1

          const Latin1: Encoder;
          • Latin1 encoding strategy.

          variable Utf16

          const Utf16: Encoder;
          • UTF-16 BE encoding strategy.

          variable Utf16BE

          const Utf16BE: Encoder;

            variable Utf16LE

            const Utf16LE: Encoder;
            • UTF-16 LE encoding strategy.

            variable Utf8

            const Utf8: Encoder;
            • UTF-8 encoding strategy.

            namespace global.CryptoJS.format

            namespace global.CryptoJS.format {}
            • Format namespace.

            variable Hex

            const Hex: Format;

              variable OpenSSL

              const OpenSSL: Format;
              • OpenSSL formatting strategy.

              namespace global.CryptoJS.kdf

              namespace global.CryptoJS.kdf {}
              • Key derivation function namespace.

              variable OpenSSL

              const OpenSSL: {
              execute(
              password: string,
              keySize: number,
              ivSize: number,
              salt?: WordArray | string,
              hasher?: Hasher
              ): CipherParams;
              };
              • OpenSSL key derivation function.

              namespace global.CryptoJS.lib

              namespace global.CryptoJS.lib {}
              • Library namespace.

              variable Base

              const Base: {
              extend(overrides: object): any;
              create(...args: any[]): any;
              mixIn(properties: object): any;
              };
              • Base object for prototypal inheritance.

              variable BlockCipherMode

              const BlockCipherMode: any;
              • Abstract base block cipher mode template.

              variable BufferedBlockAlgorithm

              const BufferedBlockAlgorithm: any;

                variable Cipher

                const Cipher: { _createHelper(cipher: Cipher): CipherHelper };

                  variable CipherParams

                  const CipherParams: { create(cipherParams: Partial<CipherParams>): CipherParams };

                    variable Hasher

                    const Hasher: {
                    _createHelper(hasher: HasherStatic): HasherHelper;
                    _createHmacHelper(hasher: HasherStatic): HmacHasherHelper;
                    };

                      variable PasswordBasedCipher

                      const PasswordBasedCipher: {
                      encrypt(
                      cipher: CipherStatic,
                      message: WordArray | string,
                      password: string,
                      cfg?: CipherOption
                      ): CipherParams;
                      decrypt(
                      cipher: CipherStatic,
                      ciphertext: CipherParams | string,
                      password: string,
                      cfg?: CipherOption
                      ): WordArray;
                      };
                      • A serializable cipher wrapper that derives the key from a password, and returns ciphertext as a serializable cipher params object.

                      variable SerializableCipher

                      const SerializableCipher: {
                      encrypt(
                      cipher: CipherStatic,
                      message: WordArray | string,
                      key: WordArray,
                      cfg?: CipherOption
                      ): CipherParams;
                      decrypt(
                      cipher: CipherStatic,
                      ciphertext: WordArray | string,
                      key: WordArray,
                      cfg?: CipherOption
                      ): CipherParams;
                      _parse(ciphertext: CipherParams | string, format: Format): CipherParams;
                      };
                      • A cipher wrapper that returns ciphertext as a serializable cipher params object.

                      variable WordArray

                      const WordArray: {
                      create(
                      words?:
                      | number[]
                      | ArrayBuffer
                      | Uint8Array
                      | Int8Array
                      | Uint8ClampedArray
                      | Int16Array
                      | Uint16Array
                      | Int32Array
                      | Uint32Array
                      | Float32Array
                      | Float64Array,
                      sigBytes?: number
                      ): WordArray;
                      random(nBytes: number): WordArray;
                      };

                        interface CipherParams

                        interface CipherParams {}
                        • A collection of cipher parameters.

                        property algorithm

                        algorithm: CipherStatic;
                        • The cipher algorithm.

                        property blockSize

                        blockSize: number;
                        • The block size of the cipher.

                        property ciphertext

                        ciphertext: WordArray;
                        • The raw ciphertext.

                        property formatter

                        formatter: Format;
                        • The default formatting strategy to convert this cipher params object to a string.

                        property iv

                        iv: WordArray;
                        • The IV used in the ciphering operation.

                        property key

                        key: WordArray;
                        • The key to this ciphertext.

                        property mode

                        mode: Mode;
                        • The block mode used in the ciphering operation.

                        property padding

                        padding: Padding;
                        • The padding scheme used in the ciphering operation.

                        property salt

                        salt: WordArray;
                        • The salt used with a key derivation function.

                        method toString

                        toString: (formatter?: Format) => string;
                        • Converts this cipher params object to a string.

                          Parameter formatter

                          (Optional) The formatting strategy to use.

                          The stringified cipher params.

                          Throws

                          Error If neither the formatter nor the default formatter is set.

                          Example 1

                          var string = cipherParams + ''; var string = cipherParams.toString(); var string = cipherParams.toString(CryptoJS.format.OpenSSL);

                        interface StreamCipher

                        interface StreamCipher extends Cipher {}
                        • Abstract base stream cipher template.

                        property blockSize

                        blockSize: number;
                        • The number of 32-bit words this cipher operates on. Default: 1 (32 bits)

                        interface WordArray

                        interface WordArray {}
                        • An array of 32-bit words.

                        property sigBytes

                        sigBytes: number;
                        • The number of significant bytes in this word array.

                        property words

                        words: number[];
                        • The array of 32-bit words.

                        method clamp

                        clamp: () => void;
                        • Removes insignificant bits.

                          Example 1

                          wordArray.clamp();

                        method clone

                        clone: () => WordArray;
                        • Creates a copy of this word array.

                          The clone.

                          Example 1

                          var clone = wordArray.clone();

                        method concat

                        concat: (wordArray: WordArray) => this;
                        • Concatenates a word array to this word array.

                          Parameter wordArray

                          The word array to append.

                          This word array.

                          Example 1

                          wordArray1.concat(wordArray2);

                        method toString

                        toString: (encoder?: Encoder) => string;
                        • Converts this word array to a string.

                          Parameter encoder

                          (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex

                          The stringified word array.

                          Example 1

                          var string = wordArray + ''; var string = wordArray.toString(); var string = wordArray.toString(CryptoJS.enc.Utf8);

                        namespace global.CryptoJS.mode

                        namespace global.CryptoJS.mode {}
                        • Mode namespace.

                        variable CBC

                        const CBC: BlockCipherMode;
                        • Cipher Block Chaining mode.

                        variable CFB

                        const CFB: BlockCipherMode;
                        • Cipher Feedback block mode.

                        variable CTR

                        const CTR: BlockCipherMode;
                        • Counter block mode.

                        variable CTRGladman

                        const CTRGladman: BlockCipherMode;
                        • Counter block mode compatible with Dr Brian Gladman fileenc.c derived from CryptoJS.mode.CTR Jan Hruby jhruby.web@gmail.com

                        variable ECB

                        const ECB: BlockCipherMode;
                        • Electronic Codebook block mode.

                        variable OFB

                        const OFB: BlockCipherMode;
                        • Output Feedback block mode.

                        namespace global.CryptoJS.pad

                        namespace global.CryptoJS.pad {}
                        • Padding namespace.

                        variable AnsiX923

                        const AnsiX923: Padding;
                        • ANSI X.923 padding strategy.

                        variable Iso10126

                        const Iso10126: Padding;
                        • ISO 10126 padding strategy.

                        variable Iso97971

                        const Iso97971: Padding;
                        • ISO/IEC 9797-1 Padding Method 2.

                        variable NoPadding

                        const NoPadding: Padding;
                        • A noop padding strategy.

                        variable Pkcs7

                        const Pkcs7: Padding;
                        • PKCS #5/7 padding strategy.

                        variable ZeroPadding

                        const ZeroPadding: Padding;
                        • Zero padding strategy.

                        namespace global.CryptoJS.x64

                        namespace global.CryptoJS.x64 {}
                        • x64 namespace.

                        variable Word

                        const Word: { create(high: number, low: number): X64Word };

                          variable WordArray

                          const WordArray: { create(words?: X64WordArray[], sigBytes?: number): X64WordArray };
                          • Initializes a newly created word array.

                            Parameter words

                            (Optional) An array of CryptoJS.x64.Word objects.

                            Parameter sigBytes

                            (Optional) The number of significant bytes in the words.

                            Example 1

                            var wordArray = CryptoJS.x64.WordArray.create();

                            var wordArray = CryptoJS.x64.WordArray.create([ CryptoJS.x64.Word.create(0x00010203, 0x04050607), CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) ]);

                            var wordArray = CryptoJS.x64.WordArray.create([ CryptoJS.x64.Word.create(0x00010203, 0x04050607), CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) ], 10);

                          interface Word

                          interface Word {}
                          • A 64-bit word.

                          method add

                          add: (word: X64Word) => X64Word;
                          • Adds this word with the passed word.

                            Parameter word

                            The x64-Word to add with this word.

                            A new x64-Word object after adding.

                            Example 1

                            var added = x64Word.add(anotherX64Word);

                          method and

                          and: (word: X64Word) => X64Word;
                          • Bitwise ANDs this word with the passed word.

                            Parameter word

                            The x64-Word to AND with this word.

                            A new x64-Word object after ANDing.

                            Example 1

                            var anded = x64Word.and(anotherX64Word);

                          method not

                          not: () => X64Word;
                          • Bitwise NOTs this word.

                            A new x64-Word object after negating.

                            Example 1

                            var negated = x64Word.not();

                          method or

                          or: (word: X64Word) => X64Word;
                          • Bitwise ORs this word with the passed word.

                            Parameter word

                            The x64-Word to OR with this word.

                            A new x64-Word object after ORing.

                            Example 1

                            var ored = x64Word.or(anotherX64Word);

                          method rotL

                          rotL: (n: number) => X64Word;
                          • Rotates this word n bits to the left.

                            Parameter n

                            The number of bits to rotate.

                            A new x64-Word object after rotating.

                            Example 1

                            var rotated = x64Word.rotL(25);

                          method rotR

                          rotR: (n: number) => X64Word;
                          • Rotates this word n bits to the right.

                            Parameter n

                            The number of bits to rotate.

                            A new x64-Word object after rotating.

                            Example 1

                            var rotated = x64Word.rotR(7);

                          method shiftL

                          shiftL: (n: number) => X64Word;
                          • Shifts this word n bits to the left.

                            Parameter n

                            The number of bits to shift.

                            A new x64-Word object after shifting.

                            Example 1

                            var shifted = x64Word.shiftL(25);

                          method shiftR

                          shiftR: (n: number) => X64Word;
                          • Shifts this word n bits to the right.

                            Parameter n

                            The number of bits to shift.

                            A new x64-Word object after shifting.

                            Example 1

                            var shifted = x64Word.shiftR(7);

                          method xor

                          xor: (word: X64Word) => X64Word;
                          • Bitwise XORs this word with the passed word.

                            Parameter word

                            The x64-Word to XOR with this word.

                            A new x64-Word object after XORing.

                            Example 1

                            var xored = x64Word.xor(anotherX64Word);

                          namespace kdf

                          namespace kdf {}
                          • Key derivation function namespace.

                          variable OpenSSL

                          const OpenSSL: {
                          execute(
                          password: string,
                          keySize: number,
                          ivSize: number,
                          salt?: WordArray | string,
                          hasher?: Hasher
                          ): CipherParams;
                          };
                          • OpenSSL key derivation function.

                          namespace lib

                          namespace lib {}
                          • Library namespace.

                          variable Base

                          const Base: {
                          extend(overrides: object): any;
                          create(...args: any[]): any;
                          mixIn(properties: object): any;
                          };
                          • Base object for prototypal inheritance.

                          variable BlockCipherMode

                          const BlockCipherMode: any;
                          • Abstract base block cipher mode template.

                          variable BufferedBlockAlgorithm

                          const BufferedBlockAlgorithm: any;

                            variable Cipher

                            const Cipher: { _createHelper(cipher: Cipher): CipherHelper };

                              variable CipherParams

                              const CipherParams: { create(cipherParams: Partial<CipherParams>): CipherParams };

                                variable Hasher

                                const Hasher: {
                                _createHelper(hasher: HasherStatic): HasherHelper;
                                _createHmacHelper(hasher: HasherStatic): HmacHasherHelper;
                                };

                                  variable PasswordBasedCipher

                                  const PasswordBasedCipher: {
                                  encrypt(
                                  cipher: CipherStatic,
                                  message: WordArray | string,
                                  password: string,
                                  cfg?: CipherOption
                                  ): CipherParams;
                                  decrypt(
                                  cipher: CipherStatic,
                                  ciphertext: CipherParams | string,
                                  password: string,
                                  cfg?: CipherOption
                                  ): WordArray;
                                  };
                                  • A serializable cipher wrapper that derives the key from a password, and returns ciphertext as a serializable cipher params object.

                                  variable SerializableCipher

                                  const SerializableCipher: {
                                  encrypt(
                                  cipher: CipherStatic,
                                  message: WordArray | string,
                                  key: WordArray,
                                  cfg?: CipherOption
                                  ): CipherParams;
                                  decrypt(
                                  cipher: CipherStatic,
                                  ciphertext: WordArray | string,
                                  key: WordArray,
                                  cfg?: CipherOption
                                  ): CipherParams;
                                  _parse(ciphertext: CipherParams | string, format: Format): CipherParams;
                                  };
                                  • A cipher wrapper that returns ciphertext as a serializable cipher params object.

                                  variable WordArray

                                  const WordArray: {
                                  create(
                                  words?:
                                  | number[]
                                  | ArrayBuffer
                                  | Uint8Array
                                  | Int8Array
                                  | Uint8ClampedArray
                                  | Int16Array
                                  | Uint16Array
                                  | Int32Array
                                  | Uint32Array
                                  | Float32Array
                                  | Float64Array,
                                  sigBytes?: number
                                  ): WordArray;
                                  random(nBytes: number): WordArray;
                                  };

                                    interface CipherParams

                                    interface CipherParams {}
                                    • A collection of cipher parameters.

                                    property algorithm

                                    algorithm: CipherStatic;
                                    • The cipher algorithm.

                                    property blockSize

                                    blockSize: number;
                                    • The block size of the cipher.

                                    property ciphertext

                                    ciphertext: WordArray;
                                    • The raw ciphertext.

                                    property formatter

                                    formatter: Format;
                                    • The default formatting strategy to convert this cipher params object to a string.

                                    property iv

                                    iv: WordArray;
                                    • The IV used in the ciphering operation.

                                    property key

                                    key: WordArray;
                                    • The key to this ciphertext.

                                    property mode

                                    mode: Mode;
                                    • The block mode used in the ciphering operation.

                                    property padding

                                    padding: Padding;
                                    • The padding scheme used in the ciphering operation.

                                    property salt

                                    salt: WordArray;
                                    • The salt used with a key derivation function.

                                    method toString

                                    toString: (formatter?: Format) => string;
                                    • Converts this cipher params object to a string.

                                      Parameter formatter

                                      (Optional) The formatting strategy to use.

                                      The stringified cipher params.

                                      Throws

                                      Error If neither the formatter nor the default formatter is set.

                                      Example 1

                                      var string = cipherParams + ''; var string = cipherParams.toString(); var string = cipherParams.toString(CryptoJS.format.OpenSSL);

                                    interface StreamCipher

                                    interface StreamCipher extends Cipher {}
                                    • Abstract base stream cipher template.

                                    property blockSize

                                    blockSize: number;
                                    • The number of 32-bit words this cipher operates on. Default: 1 (32 bits)

                                    interface WordArray

                                    interface WordArray {}
                                    • An array of 32-bit words.

                                    property sigBytes

                                    sigBytes: number;
                                    • The number of significant bytes in this word array.

                                    property words

                                    words: number[];
                                    • The array of 32-bit words.

                                    method clamp

                                    clamp: () => void;
                                    • Removes insignificant bits.

                                      Example 1

                                      wordArray.clamp();

                                    method clone

                                    clone: () => WordArray;
                                    • Creates a copy of this word array.

                                      The clone.

                                      Example 1

                                      var clone = wordArray.clone();

                                    method concat

                                    concat: (wordArray: WordArray) => this;
                                    • Concatenates a word array to this word array.

                                      Parameter wordArray

                                      The word array to append.

                                      This word array.

                                      Example 1

                                      wordArray1.concat(wordArray2);

                                    method toString

                                    toString: (encoder?: Encoder) => string;
                                    • Converts this word array to a string.

                                      Parameter encoder

                                      (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex

                                      The stringified word array.

                                      Example 1

                                      var string = wordArray + ''; var string = wordArray.toString(); var string = wordArray.toString(CryptoJS.enc.Utf8);

                                    namespace mode

                                    namespace mode {}
                                    • Mode namespace.

                                    variable CBC

                                    const CBC: BlockCipherMode;
                                    • Cipher Block Chaining mode.

                                    variable CFB

                                    const CFB: BlockCipherMode;
                                    • Cipher Feedback block mode.

                                    variable CTR

                                    const CTR: BlockCipherMode;
                                    • Counter block mode.

                                    variable CTRGladman

                                    const CTRGladman: BlockCipherMode;
                                    • Counter block mode compatible with Dr Brian Gladman fileenc.c derived from CryptoJS.mode.CTR Jan Hruby jhruby.web@gmail.com

                                    variable ECB

                                    const ECB: BlockCipherMode;
                                    • Electronic Codebook block mode.

                                    variable OFB

                                    const OFB: BlockCipherMode;
                                    • Output Feedback block mode.

                                    namespace pad

                                    namespace pad {}
                                    • Padding namespace.

                                    variable AnsiX923

                                    const AnsiX923: Padding;
                                    • ANSI X.923 padding strategy.

                                    variable Iso10126

                                    const Iso10126: Padding;
                                    • ISO 10126 padding strategy.

                                    variable Iso97971

                                    const Iso97971: Padding;
                                    • ISO/IEC 9797-1 Padding Method 2.

                                    variable NoPadding

                                    const NoPadding: Padding;
                                    • A noop padding strategy.

                                    variable Pkcs7

                                    const Pkcs7: Padding;
                                    • PKCS #5/7 padding strategy.

                                    variable ZeroPadding

                                    const ZeroPadding: Padding;
                                    • Zero padding strategy.

                                    namespace x64

                                    namespace x64 {}
                                    • x64 namespace.

                                    variable Word

                                    const Word: { create(high: number, low: number): X64Word };

                                      variable WordArray

                                      const WordArray: { create(words?: X64WordArray[], sigBytes?: number): X64WordArray };
                                      • Initializes a newly created word array.

                                        Parameter words

                                        (Optional) An array of CryptoJS.x64.Word objects.

                                        Parameter sigBytes

                                        (Optional) The number of significant bytes in the words.

                                        Example 1

                                        var wordArray = CryptoJS.x64.WordArray.create();

                                        var wordArray = CryptoJS.x64.WordArray.create([ CryptoJS.x64.Word.create(0x00010203, 0x04050607), CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) ]);

                                        var wordArray = CryptoJS.x64.WordArray.create([ CryptoJS.x64.Word.create(0x00010203, 0x04050607), CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) ], 10);

                                      interface Word

                                      interface Word {}
                                      • A 64-bit word.

                                      method add

                                      add: (word: X64Word) => X64Word;
                                      • Adds this word with the passed word.

                                        Parameter word

                                        The x64-Word to add with this word.

                                        A new x64-Word object after adding.

                                        Example 1

                                        var added = x64Word.add(anotherX64Word);

                                      method and

                                      and: (word: X64Word) => X64Word;
                                      • Bitwise ANDs this word with the passed word.

                                        Parameter word

                                        The x64-Word to AND with this word.

                                        A new x64-Word object after ANDing.

                                        Example 1

                                        var anded = x64Word.and(anotherX64Word);

                                      method not

                                      not: () => X64Word;
                                      • Bitwise NOTs this word.

                                        A new x64-Word object after negating.

                                        Example 1

                                        var negated = x64Word.not();

                                      method or

                                      or: (word: X64Word) => X64Word;
                                      • Bitwise ORs this word with the passed word.

                                        Parameter word

                                        The x64-Word to OR with this word.

                                        A new x64-Word object after ORing.

                                        Example 1

                                        var ored = x64Word.or(anotherX64Word);

                                      method rotL

                                      rotL: (n: number) => X64Word;
                                      • Rotates this word n bits to the left.

                                        Parameter n

                                        The number of bits to rotate.

                                        A new x64-Word object after rotating.

                                        Example 1

                                        var rotated = x64Word.rotL(25);

                                      method rotR

                                      rotR: (n: number) => X64Word;
                                      • Rotates this word n bits to the right.

                                        Parameter n

                                        The number of bits to rotate.

                                        A new x64-Word object after rotating.

                                        Example 1

                                        var rotated = x64Word.rotR(7);

                                      method shiftL

                                      shiftL: (n: number) => X64Word;
                                      • Shifts this word n bits to the left.

                                        Parameter n

                                        The number of bits to shift.

                                        A new x64-Word object after shifting.

                                        Example 1

                                        var shifted = x64Word.shiftL(25);

                                      method shiftR

                                      shiftR: (n: number) => X64Word;
                                      • Shifts this word n bits to the right.

                                        Parameter n

                                        The number of bits to shift.

                                        A new x64-Word object after shifting.

                                        Example 1

                                        var shifted = x64Word.shiftR(7);

                                      method xor

                                      xor: (word: X64Word) => X64Word;
                                      • Bitwise XORs this word with the passed word.

                                        Parameter word

                                        The x64-Word to XOR with this word.

                                        A new x64-Word object after XORing.

                                        Example 1

                                        var xored = x64Word.xor(anotherX64Word);

                                      Package Files (1)

                                      Dependencies (0)

                                      No dependencies.

                                      Dev Dependencies (0)

                                      No dev dependencies.

                                      Peer Dependencies (0)

                                      No peer dependencies.

                                      Badge

                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/crypto-js.

                                      • Markdown
                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/crypto-js)
                                      • HTML
                                        <a href="https://www.jsdocs.io/package/@types/crypto-js"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>