Socket
Socket
Sign inDemoInstall

libsodium-sumo

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libsodium-sumo

The Sodium cryptographic library compiled to pure JavaScript (raw library, no wrappers, sumo variant)


Version published
Weekly downloads
112K
increased by5.97%
Maintainers
1
Weekly downloads
 
Created

What is libsodium-sumo?

libsodium-sumo is a cryptographic library that provides a wide range of cryptographic operations. It is a higher-level API for the Sodium library, which is designed to be easy to use, secure, and fast. The 'sumo' version includes additional features and algorithms that are not available in the standard libsodium package.

What are libsodium-sumo's main functionalities?

Public Key Cryptography

This feature allows you to perform public key cryptography operations such as encryption and decryption. The code sample demonstrates generating a key pair, encrypting a message, and logging the ciphertext.

const sodium = require('libsodium-sumo');
sodium.ready.then(() => {
  const keyPair = sodium.crypto_box_keypair();
  const message = 'Hello, World!';
  const nonce = sodium.randombytes_buf(sodium.crypto_box_NONCEBYTES);
  const cipherText = sodium.crypto_box_easy(message, nonce, keyPair.publicKey, keyPair.privateKey);
  console.log('Cipher Text:', cipherText);
});

Secret Key Cryptography

This feature allows you to perform secret key cryptography operations such as encryption and decryption. The code sample demonstrates generating a secret key, encrypting a message, and logging the ciphertext.

const sodium = require('libsodium-sumo');
sodium.ready.then(() => {
  const key = sodium.randombytes_buf(sodium.crypto_secretbox_KEYBYTES);
  const message = 'Hello, World!';
  const nonce = sodium.randombytes_buf(sodium.crypto_secretbox_NONCEBYTES);
  const cipherText = sodium.crypto_secretbox_easy(message, nonce, key);
  console.log('Cipher Text:', cipherText);
});

Hashing

This feature allows you to perform hashing operations. The code sample demonstrates hashing a message and logging the hash.

const sodium = require('libsodium-sumo');
sodium.ready.then(() => {
  const message = 'Hello, World!';
  const hash = sodium.crypto_generichash(32, message);
  console.log('Hash:', hash);
});

Password Hashing

This feature allows you to perform password hashing operations. The code sample demonstrates hashing a password and logging the hashed password.

const sodium = require('libsodium-sumo');
sodium.ready.then(() => {
  const password = 'mysecretpassword';
  const hashedPassword = sodium.crypto_pwhash_str(password, sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE, sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE);
  console.log('Hashed Password:', hashedPassword);
});

Other packages similar to libsodium-sumo

Keywords

FAQs

Package last updated on 29 Jan 2021

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