Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
asmcrypto.js
Advanced tools
asmcrypto.js is a JavaScript library that provides cryptographic algorithms implemented in WebAssembly and JavaScript. It aims to offer high-performance cryptographic operations for web applications.
Hashing
This feature allows you to perform hashing operations. The example demonstrates how to compute the SHA-256 hash of a string.
const asmCrypto = require('asmcrypto.js');
const hash = asmCrypto.SHA256.hex('Hello, World!');
console.log(hash);
Symmetric Encryption
This feature allows you to perform symmetric encryption using algorithms like AES. The example shows how to encrypt a string using AES-CBC.
const asmCrypto = require('asmcrypto.js');
const key = asmCrypto.AES_CBC.generateKey(16);
const encrypted = asmCrypto.AES_CBC.encrypt(asmCrypto.string_to_bytes('Hello, World!'), key);
console.log(encrypted);
Asymmetric Encryption
This feature allows you to perform asymmetric encryption using algorithms like RSA. The example demonstrates how to encrypt a string using RSA.
const asmCrypto = require('asmcrypto.js');
const keyPair = asmCrypto.RSA.generateKey(1024);
const encrypted = asmCrypto.RSA.encrypt(asmCrypto.string_to_bytes('Hello, World!'), keyPair.publicKey);
console.log(encrypted);
Digital Signatures
This feature allows you to create digital signatures. The example shows how to sign a string using RSA.
const asmCrypto = require('asmcrypto.js');
const keyPair = asmCrypto.RSA.generateKey(1024);
const signature = asmCrypto.RSA.sign(asmCrypto.string_to_bytes('Hello, World!'), keyPair.privateKey);
console.log(signature);
crypto-js is a widely-used library that provides standard and secure cryptographic algorithms implemented in JavaScript. It is known for its ease of use and comprehensive documentation. Compared to asmcrypto.js, crypto-js does not utilize WebAssembly for performance optimization.
node-forge is a robust library that offers a wide range of cryptographic operations, including SSL/TLS, PKI, and more. It is highly versatile and suitable for both client-side and server-side applications. Unlike asmcrypto.js, node-forge is purely JavaScript-based and does not leverage WebAssembly.
Stanford JavaScript Crypto Library (sjcl) is a compact, fast, and secure cryptographic library. It is designed to be easy to use and includes a variety of cryptographic primitives. While sjcl is efficient, it does not use WebAssembly for performance enhancements like asmcrypto.js.
JavaScript implementation of popular cryptographic utilities with performance in mind.
Then download and build the stuff:
git clone https://github.com/asmcrypto/asmcrypto.js.git
cd asmcrypto.js/
npm install
Running tests is always a good idea:
npm test
Congratulations! Now you have your asmcrypto.js
ready to use ☺
FAQs
Asm.js implementation of WebCrypto API
The npm package asmcrypto.js receives a total of 115,421 weekly downloads. As such, asmcrypto.js popularity was classified as popular.
We found that asmcrypto.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.