npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cryptojs2

v1.0.2

Published

cryptojs2 with import

Downloads

20

Readme

cryptojs2

JavaScript library of crypto standards.

Node.js (Install)

Requirements:

  • Node.js
npm install cryptojs2

Usage

Node.js

import sha256 from 'cryptojs2/sha256';
import hmacSHA256 from 'cryptojs2/hmac-sha256'; 
//or
import {SHA256 as sha256,HmacSHA256 as hmacSha256} from "cryptojs2";   

const message, nonce, path, privateKey; // ...
const hashDigest = sha256(nonce + message);
const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));

Client (browser)

Requirements:

Usage

Modular include:

Usage without RequireJS

<script type="module">
import sha256 from 'cryptojs2/sha256';
import hmacSHA256 from 'cryptojs2/hmac-sha256'; 
//or
import {SHA256 as sha256,HmacSHA256 as hmacSha256} from "cryptojs2";   

window.sha256 = sha256; //FOR USE ALL DOCUMENT
window.hmacSHA256 = hmacSHA256; //FOR USE ALL DOCUMENT
    var hashSHA256 = sha256("Message");
    var hashhmacSha256 =hmacSha256("stringToSign", "signingKey");
</script>

AES Encryption

Plain text encryption

import aes from 'cryptojs2/AES';
import hmacSHA256 from 'cryptojs2/hmac-sha256'; 

// Encrypt
var ciphertext = aes.encrypt('message', 'secret key').toString();

// Decrypt
var bytes  = aes.decrypt(ciphertext, 'secret key');
var originalText = bytes.toString();

console.log(originalText); // 'message'

Object encryption

import aes from 'cryptojs2/AES';

var data = [{id: 1}, {id: 2}]

// Encrypt
var ciphertext = aes.encrypt(JSON.stringify(data), 'secret key 123').toString();

// Decrypt
var bytes  = aes.decrypt(ciphertext, 'secret key 123');
var decryptedData = JSON.parse(bytes.toString());

console.log(decryptedData); // [{id: 1}, {id: 2}]

List of modules

  • cryptojs2/md5
  • cryptojs2/sha1
  • cryptojs2/sha256
  • cryptojs2/sha224
  • cryptojs2/sha512
  • cryptojs2/sha384
  • cryptojs2/sha3
  • cryptojs2/ripemd160

  • cryptojs2/hmac-md5
  • cryptojs2/hmac-sha1
  • cryptojs2/hmac-sha256
  • cryptojs2/hmac-sha224
  • cryptojs2/hmac-sha512
  • cryptojs2/hmac-sha384
  • cryptojs2/hmac-sha3
  • cryptojs2/hmac-ripemd160

  • cryptojs2/pbkdf2

  • cryptojs2/aes
  • cryptojs2/tripledes
  • cryptojs2/rc4
  • cryptojs2/rabbit
  • cryptojs2/rabbit-legacy

License

MIT license; see LICENSE.