Socket
Socket
Sign inDemoInstall

@types/crypto-js

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/crypto-js

TypeScript definitions for crypto-js


Version published
Weekly downloads
1.4M
decreased by-15.82%
Maintainers
1
Weekly downloads
 
Created

What is @types/crypto-js?

The @types/crypto-js package provides TypeScript type definitions for the crypto-js library, which is a collection of cryptographic algorithms implemented in JavaScript. It allows developers to work with crypto-js in TypeScript projects by offering type checking and IntelliSense support for the various cryptographic functions provided by crypto-js.

What are @types/crypto-js's main functionalities?

Hashing

This feature allows for the generation of cryptographic hashes using various algorithms like SHA256. The code sample demonstrates how to create a SHA256 hash of a message.

import CryptoJS from 'crypto-js';
const message = 'hello';
const hash = CryptoJS.SHA256(message).toString();
console.log(hash);

Encryption/Decryption

This feature enables the encryption and decryption of messages using symmetric-key algorithms like AES. The code sample shows how to encrypt and then decrypt a message using AES with a secret key.

import CryptoJS from 'crypto-js';
const message = 'secret message';
const key = 'secret key';
const encrypted = CryptoJS.AES.encrypt(message, key).toString();
const decrypted = CryptoJS.AES.decrypt(encrypted, key).toString(CryptoJS.enc.Utf8);
console.log(decrypted);

HMAC

This feature provides the ability to generate Hash-based Message Authentication Codes (HMAC) using various hash functions. The code sample illustrates generating an HMAC using the SHA256 hash function and a secret key.

import CryptoJS from 'crypto-js';
const message = 'message';
const key = 'secret';
const hmac = CryptoJS.HmacSHA256(message, key).toString();
console.log(hmac);

Other packages similar to @types/crypto-js

FAQs

Package last updated on 22 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc