Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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)

  • 0.7.14
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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 09 Jul 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