holepunchto/sodium-universal

Universal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser

JavaScript

71

45 commits

updated Jan 9, 2026

See the code

README

sodium-universal

Universal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser

npm install sodium-universal

sodium-native ships with prebuilds for macOS, Windows, and Linux.

Note that the module itself is generated on a prepublish hook.

Usage

var sodium = require('sodium-universal')

var rnd = Buffer.allocUnsafe(12) // Cryptographically random data
sodium.randombytes_buf(rnd)

console.log(rnd.toString('hex'))

Works seamlessly with Node.js:

$ node example.js
c7dbd46a6cc84ff2e0d1285c

And the browser:

First install the peer dep, sodium-javascript.

npm install --save sodium-javascript

And then browserify

browserify example.js > bundle.js

Introduction

libsodium is a collection of cryptographic primitives, providing a low-level foundation to build higher-level cryptographic applications and protocols. It is often put in contrast to RSA based cryptography and OpenSSL, even though they all share overlapping algorithms and target slightly different audiences. Sodium is a collection of modern collection of primitives, fulfilling the same cryptographic tasks, but based on simpler and more efficient algorithms.

This library provides seamless bindings to sodium-native, which is the original C implementation of libsodium exposed as a Node native module. For the browser we expose sodium-javascript, using the package.json browser field, which is supported by most bundlers.

API

Please refer to sodium-native and sodium-javascript. Note that the two modules do not yet have feature parity, where sodium-native is the more featureful of the two.

Compatibilty

C Library Symbolsodium-nativesodium-javascript
crypto_aead_chacha20poly1305_ietf_ABYTES✅✅
crypto_aead_chacha20poly1305_ietf_decrypt✅✅
crypto_aead_chacha20poly1305_ietf_decrypt_detached✅✅
crypto_aead_chacha20poly1305_ietf_encrypt✅✅
crypto_aead_chacha20poly1305_ietf_encrypt_detached✅✅
crypto_aead_chacha20poly1305_ietf_KEYBYTES✅✅
crypto_aead_chacha20poly1305_ietf_keygen✅🔺
crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX✅✅
crypto_aead_chacha20poly1305_ietf_NPUBBYTES✅✅
crypto_aead_chacha20poly1305_ietf_NSECBYTES✅✅
crypto_aead_xchacha20poly1305_ietf_ABYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_decrypt✅🔺
crypto_aead_xchacha20poly1305_ietf_decrypt_detached✅🔺
crypto_aead_xchacha20poly1305_ietf_encrypt✅🔺
crypto_aead_xchacha20poly1305_ietf_encrypt_detached✅🔺
crypto_aead_xchacha20poly1305_ietf_KEYBYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_keygen✅🔺
crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX✅🔺
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_NSECBYTES✅🔺
crypto_auth✅🔺
crypto_auth_BYTES✅🔺
crypto_auth_KEYBYTES✅🔺
crypto_auth_verify✅🔺
crypto_box_BEFORENMBYTES🔺✅
crypto_box_BOXZEROBYTES🔺✅
crypto_box_detached✅🔺
crypto_box_easy✅🔺
crypto_box_keypair✅✅
crypto_box_MACBYTES✅🔺
crypto_box_NONCEBYTES✅✅
crypto_box_open_detached✅🔺
crypto_box_open_easy✅🔺
crypto_box_PUBLICKEYBYTES✅✅
crypto_box_seal✅✅
crypto_box_seal_open✅✅
crypto_box_SEALBYTES✅✅
crypto_box_SECRETKEYBYTES✅✅
crypto_box_seed_keypair✅✅
crypto_box_SEEDBYTES✅✅
crypto_box_ZEROBYTES🔺✅
crypto_core_ed25519_add✅🔺
crypto_core_ed25519_BYTES✅🔺
crypto_core_ed25519_from_uniform✅🔺
crypto_core_ed25519_is_valid_point✅🔺
crypto_core_ed25519_NONREDUCEDSCALARBYTES✅🔺
crypto_core_ed25519_scalar_add✅🔺
crypto_core_ed25519_scalar_complement✅🔺
crypto_core_ed25519_scalar_invert✅🔺
crypto_core_ed25519_scalar_negate✅🔺
crypto_core_ed25519_scalar_random✅🔺
crypto_core_ed25519_scalar_reduce✅🔺
crypto_core_ed25519_scalar_sub✅🔺
crypto_core_ed25519_SCALARBYTES✅🔺
crypto_core_ed25519_sub✅🔺
crypto_core_ed25519_UNIFORMBYTES✅🔺
crypto_generichash✅✅
crypto_generichash_BYTES✅✅
crypto_generichash_BYTES_MAX✅✅
crypto_generichash_BYTES_MIN✅✅
crypto_generichash_final✅🔺
crypto_generichash_init✅🔺
crypto_generichash_KEYBYTES✅✅
crypto_generichash_KEYBYTES_MAX✅✅
crypto_generichash_KEYBYTES_MIN✅✅
crypto_generichash_keygen✅🔺
crypto_generichash_STATEBYTES✅🔺
crypto_generichash_update✅🔺
crypto_hash✅✅
crypto_hash_BYTES✅✅
crypto_hash_sha256✅✅
crypto_hash_sha256_BYTES✅✅
crypto_hash_sha256_final✅🔺
crypto_hash_sha256_init✅🔺
crypto_hash_sha256_STATEBYTES✅🔺
crypto_hash_sha256_update✅🔺
crypto_hash_sha512✅✅
crypto_hash_sha512_BYTES✅✅
crypto_hash_sha512_final✅🔺
crypto_hash_sha512_init✅🔺
crypto_hash_sha512_STATEBYTES✅🔺
crypto_hash_sha512_update✅🔺
crypto_kdf_BYTES_MAX✅✅
crypto_kdf_BYTES_MIN✅✅
crypto_kdf_CONTEXTBYTES✅✅
crypto_kdf_derive_from_key✅✅
crypto_kdf_KEYBYTES✅✅
crypto_kdf_keygen✅✅
crypto_kx_client_session_keys✅🔺
crypto_kx_keypair✅✅
crypto_kx_PUBLICKEYBYTES✅✅
crypto_kx_SECRETKEYBYTES✅✅
crypto_kx_seed_keypair✅✅
crypto_kx_SEEDBYTES✅✅
crypto_kx_server_session_keys✅🔺
crypto_kx_SESSIONKEYBYTES✅🔺
crypto_onetimeauth✅✅
crypto_onetimeauth_BYTES✅🔺
crypto_onetimeauth_final✅🔺
crypto_onetimeauth_init✅🔺
crypto_onetimeauth_KEYBYTES✅🔺
crypto_onetimeauth_STATEBYTES✅🔺
crypto_onetimeauth_update✅🔺
crypto_onetimeauth_verify✅✅
crypto_pwhash✅🔺
crypto_pwhash_BYTES_MAX✅🔺
crypto_pwhash_BYTES_MIN✅🔺
crypto_pwhash_SALTBYTES✅🔺
crypto_pwhash_scryptsalsa208sha256✅🔺
crypto_pwhash_scryptsalsa208sha256_BYTES_MAX✅🔺
crypto_pwhash_scryptsalsa208sha256_BYTES_MIN✅🔺
crypto_pwhash_scryptsalsa208sha256_SALTBYTES✅🔺
crypto_pwhash_scryptsalsa208sha256_str✅🔺
crypto_pwhash_scryptsalsa208sha256_str_needs_rehash✅🔺
crypto_pwhash_scryptsalsa208sha256_str_verify✅🔺
crypto_pwhash_scryptsalsa208sha256_STRBYTES✅🔺
crypto_pwhash_str✅🔺
crypto_pwhash_str_needs_rehash✅🔺
crypto_pwhash_str_verify✅🔺
crypto_pwhash_STRBYTES✅🔺
crypto_scalarmult✅✅
crypto_scalarmult_base✅✅
crypto_scalarmult_BYTES✅✅
crypto_scalarmult_ed25519✅🔺
crypto_scalarmult_ed25519_base✅🔺
crypto_scalarmult_ed25519_base_noclamp✅🔺
crypto_scalarmult_ed25519_BYTES✅🔺
crypto_scalarmult_ed25519_noclamp✅🔺
crypto_scalarmult_ed25519_SCALARBYTES✅🔺
crypto_scalarmult_SCALARBYTES✅✅
crypto_secretbox🔺✅
crypto_secretbox_BOXZEROBYTES🔺✅
crypto_secretbox_detached✅✅
crypto_secretbox_easy✅✅
crypto_secretbox_KEYBYTES✅✅
crypto_secretbox_MACBYTES✅✅
crypto_secretbox_NONCEBYTES✅✅
crypto_secretbox_open🔺✅
crypto_secretbox_open_detached✅✅
crypto_secretbox_open_easy✅✅
crypto_secretbox_ZEROBYTES🔺✅
crypto_secretstream_xchacha20poly1305_ABYTES✅🔺
crypto_secretstream_xchacha20poly1305_HEADERBYTES✅🔺
crypto_secretstream_xchacha20poly1305_init_pull✅🔺
crypto_secretstream_xchacha20poly1305_init_push✅🔺
crypto_secretstream_xchacha20poly1305_KEYBYTES✅🔺
crypto_secretstream_xchacha20poly1305_keygen✅🔺
crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX✅🔺
crypto_secretstream_xchacha20poly1305_pull✅🔺
crypto_secretstream_xchacha20poly1305_push✅🔺
crypto_secretstream_xchacha20poly1305_rekey✅🔺
crypto_secretstream_xchacha20poly1305_STATEBYTES✅🔺
crypto_shorthash✅✅
crypto_shorthash_BYTES✅✅
crypto_shorthash_KEYBYTES✅✅
crypto_sign✅✅
crypto_sign_BYTES✅✅
crypto_sign_detached✅✅
crypto_sign_ed25519_pk_to_curve25519✅🔺
crypto_sign_ed25519_sk_to_curve25519✅🔺
crypto_sign_ed25519_sk_to_pk✅🔺
crypto_sign_keypair✅✅
crypto_sign_open✅✅
crypto_sign_PUBLICKEYBYTES✅✅
crypto_sign_SECRETKEYBYTES✅✅
crypto_sign_seed_keypair✅✅
crypto_sign_SEEDBYTES✅✅
crypto_sign_verify_detached✅✅
crypto_stream✅✅
crypto_stream_chacha20✅✅
crypto_stream_chacha20_ietf✅✅
crypto_stream_chacha20_ietf_KEYBYTES✅✅
crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX✅✅
crypto_stream_chacha20_ietf_NONCEBYTES✅✅
crypto_stream_chacha20_ietf_xor✅✅
crypto_stream_chacha20_ietf_xor_ic✅✅
crypto_stream_chacha20_KEYBYTES✅✅
crypto_stream_chacha20_MESSAGEBYTES_MAX✅✅
crypto_stream_chacha20_NONCEBYTES✅✅
crypto_stream_chacha20_xor✅✅
crypto_stream_chacha20_xor_ic✅✅
crypto_stream_KEYBYTES✅✅
crypto_stream_NONCEBYTES✅✅
crypto_stream_salsa20_KEYBYTES✅🔺
crypto_stream_salsa20_MESSAGEBYTES_MAX✅🔺
crypto_stream_salsa20_NONCEBYTES✅🔺
crypto_stream_salsa20_xor✅🔺
crypto_stream_salsa20_xor_ic✅🔺
crypto_stream_xchacha20✅🔺
crypto_stream_xchacha20_KEYBYTES✅🔺
crypto_stream_xchacha20_MESSAGEBYTES_MAX✅🔺
crypto_stream_xchacha20_NONCEBYTES✅🔺
crypto_stream_xchacha20_xor✅🔺
crypto_stream_xchacha20_xor_ic✅🔺
crypto_stream_xor✅✅
crypto_verify_16🔺✅
crypto_verify_32🔺✅
randombytes_buf✅✅
randombytes_buf_deterministic✅🔺
randombytes_random✅🔺
randombytes_SEEDBYTES✅🔺
randombytes_uniform✅🔺
sodium_add✅🔺
sodium_compare✅🔺
sodium_free✅🔺
sodium_increment✅🔺
sodium_is_zero✅✅
sodium_malloc✅✅
sodium_memcmp✅✅
sodium_memzero✅✅
sodium_mlock✅🔺
sodium_mprotect_noaccess✅🔺
sodium_mprotect_readonly✅🔺
sodium_mprotect_readwrite✅🔺
sodium_munlock✅🔺
sodium_pad✅🔺
sodium_sub✅🔺
sodium_unpad✅🔺

Missing altogether (Ctrl + F friendly)

crypto_aead_aes256gcm_ABYTES, crypto_aead_aes256gcm_beforenm, crypto_aead_aes256gcm_decrypt, crypto_aead_aes256gcm_decrypt_afternm, crypto_aead_aes256gcm_decrypt_detached, crypto_aead_aes256gcm_decrypt_detached_afternm, crypto_aead_aes256gcm_encrypt, crypto_aead_aes256gcm_encrypt_afternm, crypto_aead_aes256gcm_encrypt_detached, crypto_aead_aes256gcm_encrypt_detached_afternm, crypto_aead_aes256gcm_is_available, crypto_aead_aes256gcm_KEYBYTES, crypto_aead_aes256gcm_keygen, crypto_aead_aes256gcm_MESSAGEBYTES_MAX, crypto_aead_aes256gcm_NPUBBYTES, crypto_aead_aes256gcm_NSECBYTES, crypto_aead_aes256gcm_STATEBYTES, crypto_aead_chacha20poly1305_ABYTES, crypto_aead_chacha20poly1305_decrypt, crypto_aead_chacha20poly1305_decrypt_detached, crypto_aead_chacha20poly1305_encrypt, crypto_aead_chacha20poly1305_encrypt_detached, crypto_aead_chacha20poly1305_KEYBYTES, crypto_aead_chacha20poly1305_keygen, crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX, crypto_aead_chacha20poly1305_NPUBBYTES, crypto_aead_chacha20poly1305_NSECBYTES, crypto_auth_hmacsha256, crypto_auth_hmacsha256_BYTES, crypto_auth_hmacsha256_final, crypto_auth_hmacsha256_init, crypto_auth_hmacsha256_KEYBYTES, crypto_auth_hmacsha256_keygen, crypto_auth_hmacsha256_STATEBYTES, crypto_auth_hmacsha256_update, crypto_auth_hmacsha256_verify, crypto_auth_hmacsha512, crypto_auth_hmacsha512256, crypto_auth_hmacsha512256_BYTES, crypto_auth_hmacsha512256_final, crypto_auth_hmacsha512256_init, crypto_auth_hmacsha512256_KEYBYTES, crypto_auth_hmacsha512256_keygen, crypto_auth_hmacsha512256_STATEBYTES, crypto_auth_hmacsha512256_update, crypto_auth_hmacsha512256_verify, crypto_auth_hmacsha512_BYTES, crypto_auth_hmacsha512_final, crypto_auth_hmacsha512_init, crypto_auth_hmacsha512_KEYBYTES, crypto_auth_hmacsha512_keygen, crypto_auth_hmacsha512_STATEBYTES, crypto_auth_hmacsha512_update, crypto_auth_hmacsha512_verify, crypto_auth_keygen, crypto_auth_primitive, crypto_box, crypto_box_afternm, crypto_box_beforenm, crypto_box_curve25519xchacha20poly1305_beforenm, crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES, crypto_box_curve25519xchacha20poly1305_detached, crypto_box_curve25519xchacha20poly1305_detached_afternm, crypto_box_curve25519xchacha20poly1305_easy, crypto_box_curve25519xchacha20poly1305_easy_afternm, crypto_box_curve25519xchacha20poly1305_keypair, crypto_box_curve25519xchacha20poly1305_MACBYTES, crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX, crypto_box_curve25519xchacha20poly1305_NONCEBYTES, crypto_box_curve25519xchacha20poly1305_open_detached, crypto_box_curve25519xchacha20poly1305_open_detached_afternm, crypto_box_curve25519xchacha20poly1305_open_easy, crypto_box_curve25519xchacha20poly1305_open_easy_afternm, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES, crypto_box_curve25519xchacha20poly1305_seal, crypto_box_curve25519xchacha20poly1305_seal_open, crypto_box_curve25519xchacha20poly1305_SEALBYTES, crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES, crypto_box_curve25519xchacha20poly1305_seed_keypair, crypto_box_curve25519xchacha20poly1305_SEEDBYTES, crypto_box_curve25519xsalsa20poly1305, crypto_box_curve25519xsalsa20poly1305_afternm, crypto_box_curve25519xsalsa20poly1305_beforenm, crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES, crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES, crypto_box_curve25519xsalsa20poly1305_keypair, crypto_box_curve25519xsalsa20poly1305_MACBYTES, crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES, crypto_box_curve25519xsalsa20poly1305_open, crypto_box_curve25519xsalsa20poly1305_open_afternm, crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES, crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES, crypto_box_curve25519xsalsa20poly1305_seed_keypair, crypto_box_curve25519xsalsa20poly1305_SEEDBYTES, crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, crypto_box_detached_afternm, crypto_box_easy_afternm, crypto_box_MESSAGEBYTES_MAX, crypto_box_open, crypto_box_open_afternm, crypto_box_open_detached_afternm, crypto_box_open_easy_afternm, crypto_box_primitive, crypto_core_ed25519_from_hash, crypto_core_ed25519_HASHBYTES, crypto_core_ed25519_random, crypto_core_ed25519_scalar_mul, crypto_core_hchacha20, crypto_core_hchacha20_CONSTBYTES, crypto_core_hchacha20_INPUTBYTES, crypto_core_hchacha20_KEYBYTES, crypto_core_hchacha20_OUTPUTBYTES, crypto_core_hsalsa20, crypto_core_hsalsa20_CONSTBYTES, crypto_core_hsalsa20_INPUTBYTES, crypto_core_hsalsa20_KEYBYTES, crypto_core_hsalsa20_OUTPUTBYTES, crypto_core_ristretto255_add, crypto_core_ristretto255_BYTES, crypto_core_ristretto255_from_hash, crypto_core_ristretto255_HASHBYTES, crypto_core_ristretto255_is_valid_point, crypto_core_ristretto255_NONREDUCEDSCALARBYTES, crypto_core_ristretto255_random, crypto_core_ristretto255_scalar_add, crypto_core_ristretto255_scalar_complement, crypto_core_ristretto255_scalar_invert, crypto_core_ristretto255_scalar_mul, crypto_core_ristretto255_scalar_negate, crypto_core_ristretto255_scalar_random, crypto_core_ristretto255_scalar_reduce, crypto_core_ristretto255_scalar_sub, crypto_core_ristretto255_SCALARBYTES, crypto_core_ristretto255_sub, crypto_core_salsa20, crypto_core_salsa2012, crypto_core_salsa2012_CONSTBYTES, crypto_core_salsa2012_INPUTBYTES, crypto_core_salsa2012_KEYBYTES, crypto_core_salsa2012_OUTPUTBYTES, crypto_core_salsa208, crypto_core_salsa208_CONSTBYTES, crypto_core_salsa208_INPUTBYTES, crypto_core_salsa208_KEYBYTES, crypto_core_salsa208_OUTPUTBYTES, crypto_core_salsa20_CONSTBYTES, crypto_core_salsa20_INPUTBYTES, crypto_core_salsa20_KEYBYTES, crypto_core_salsa20_OUTPUTBYTES, crypto_generichash_blake2b, crypto_generichash_blake2b_BYTES, crypto_generichash_blake2b_BYTES_MAX, crypto_generichash_blake2b_BYTES_MIN, crypto_generichash_blake2b_final, crypto_generichash_blake2b_init, crypto_generichash_blake2b_init_salt_personal, crypto_generichash_blake2b_KEYBYTES, crypto_generichash_blake2b_KEYBYTES_MAX, crypto_generichash_blake2b_KEYBYTES_MIN, crypto_generichash_blake2b_keygen, crypto_generichash_blake2b_PERSONALBYTES, crypto_generichash_blake2b_salt_personal, crypto_generichash_blake2b_SALTBYTES, crypto_generichash_blake2b_STATEBYTES, crypto_generichash_blake2b_update, crypto_generichash_primitive, crypto_hash_primitive, crypto_kdf_blake2b_BYTES_MAX, crypto_kdf_blake2b_BYTES_MIN, crypto_kdf_blake2b_CONTEXTBYTES, crypto_kdf_blake2b_derive_from_key, crypto_kdf_blake2b_KEYBYTES, crypto_kdf_primitive, crypto_kx_primitive, crypto_onetimeauth_keygen, crypto_onetimeauth_poly1305, crypto_onetimeauth_poly1305_BYTES, crypto_onetimeauth_poly1305_final, crypto_onetimeauth_poly1305_init, crypto_onetimeauth_poly1305_KEYBYTES, crypto_onetimeauth_poly1305_keygen, crypto_onetimeauth_poly1305_STATEBYTES, crypto_onetimeauth_poly1305_update, crypto_onetimeauth_poly1305_verify, crypto_onetimeauth_primitive, crypto_pwhash_alg_argon2i13, crypto_pwhash_alg_argon2id13, crypto_pwhash_alg_default, crypto_pwhash_argon2i, crypto_pwhash_argon2i_alg_argon2i13, crypto_pwhash_argon2i_BYTES_MAX, crypto_pwhash_argon2i_BYTES_MIN, crypto_pwhash_argon2i_memlimit_interactive, crypto_pwhash_argon2i_memlimit_max, crypto_pwhash_argon2i_memlimit_min, crypto_pwhash_argon2i_memlimit_moderate, crypto_pwhash_argon2i_memlimit_sensitive, crypto_pwhash_argon2i_opslimit_interactive, crypto_pwhash_argon2i_opslimit_max, crypto_pwhash_argon2i_opslimit_min, crypto_pwhash_argon2i_opslimit_moderate, crypto_pwhash_argon2i_opslimit_sensitive, crypto_pwhash_argon2i_passwd_max, crypto_pwhash_argon2i_passwd_min, crypto_pwhash_argon2i_SALTBYTES, crypto_pwhash_argon2i_str, crypto_pwhash_argon2i_str_needs_rehash, crypto_pwhash_argon2i_str_verify, crypto_pwhash_argon2i_STRBYTES, crypto_pwhash_argon2i_strprefix, crypto_pwhash_argon2id, crypto_pwhash_argon2id_alg_argon2id13, crypto_pwhash_argon2id_BYTES_MAX, crypto_pwhash_argon2id_BYTES_MIN, crypto_pwhash_argon2id_memlimit_interactive, crypto_pwhash_argon2id_memlimit_max, crypto_pwhash_argon2id_memlimit_min, crypto_pwhash_argon2id_memlimit_moderate, crypto_pwhash_argon2id_memlimit_sensitive, crypto_pwhash_argon2id_opslimit_interactive, crypto_pwhash_argon2id_opslimit_max, crypto_pwhash_argon2id_opslimit_min, crypto_pwhash_argon2id_opslimit_moderate, crypto_pwhash_argon2id_opslimit_sensitive, crypto_pwhash_argon2id_passwd_max, crypto_pwhash_argon2id_passwd_min, crypto_pwhash_argon2id_SALTBYTES, crypto_pwhash_argon2id_str, crypto_pwhash_argon2id_str_needs_rehash, crypto_pwhash_argon2id_str_verify, crypto_pwhash_argon2id_STRBYTES, crypto_pwhash_argon2id_strprefix, crypto_pwhash_memlimit_interactive, crypto_pwhash_memlimit_max, crypto_pwhash_memlimit_min, crypto_pwhash_memlimit_moderate, crypto_pwhash_memlimit_sensitive, crypto_pwhash_opslimit_interactive, crypto_pwhash_opslimit_max, crypto_pwhash_opslimit_min, crypto_pwhash_opslimit_moderate, crypto_pwhash_opslimit_sensitive, crypto_pwhash_passwd_max, crypto_pwhash_passwd_min, crypto_pwhash_primitive, crypto_pwhash_scryptsalsa208sha256_ll, crypto_pwhash_scryptsalsa208sha256_memlimit_interactive, crypto_pwhash_scryptsalsa208sha256_memlimit_max, crypto_pwhash_scryptsalsa208sha256_memlimit_min, crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive, crypto_pwhash_scryptsalsa208sha256_opslimit_interactive, crypto_pwhash_scryptsalsa208sha256_opslimit_max, crypto_pwhash_scryptsalsa208sha256_opslimit_min, crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive, crypto_pwhash_scryptsalsa208sha256_passwd_max, crypto_pwhash_scryptsalsa208sha256_passwd_min, crypto_pwhash_scryptsalsa208sha256_strprefix, crypto_pwhash_str_alg, crypto_pwhash_strprefix, crypto_scalarmult_curve25519, crypto_scalarmult_curve25519_base, crypto_scalarmult_curve25519_BYTES, crypto_scalarmult_curve25519_SCALARBYTES, crypto_scalarmult_primitive, crypto_scalarmult_ristretto255, crypto_scalarmult_ristretto255_base, crypto_scalarmult_ristretto255_BYTES, crypto_scalarmult_ristretto255_SCALARBYTES, crypto_secretbox_keygen, crypto_secretbox_MESSAGEBYTES_MAX, crypto_secretbox_primitive, crypto_secretbox_xchacha20poly1305_detached, crypto_secretbox_xchacha20poly1305_easy, crypto_secretbox_xchacha20poly1305_KEYBYTES, crypto_secretbox_xchacha20poly1305_MACBYTES, crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX, crypto_secretbox_xchacha20poly1305_NONCEBYTES, crypto_secretbox_xchacha20poly1305_open_detached, crypto_secretbox_xchacha20poly1305_open_easy, crypto_secretbox_xsalsa20poly1305, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES, crypto_secretbox_xsalsa20poly1305_KEYBYTES, crypto_secretbox_xsalsa20poly1305_keygen, crypto_secretbox_xsalsa20poly1305_MACBYTES, crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_secretbox_xsalsa20poly1305_NONCEBYTES, crypto_secretbox_xsalsa20poly1305_open, crypto_secretbox_xsalsa20poly1305_ZEROBYTES, crypto_secretstream_xchacha20poly1305_tag_final, crypto_secretstream_xchacha20poly1305_tag_message, crypto_secretstream_xchacha20poly1305_tag_push, crypto_secretstream_xchacha20poly1305_tag_rekey, crypto_shorthash_keygen, crypto_shorthash_primitive, crypto_shorthash_siphash24, crypto_shorthash_siphash24_BYTES, crypto_shorthash_siphash24_KEYBYTES, crypto_shorthash_siphashx24, crypto_shorthash_siphashx24_BYTES, crypto_shorthash_siphashx24_KEYBYTES, crypto_sign_ed25519, crypto_sign_ed25519_BYTES, crypto_sign_ed25519_detached, crypto_sign_ed25519_keypair, crypto_sign_ed25519_MESSAGEBYTES_MAX, crypto_sign_ed25519_open, crypto_sign_ed25519_PUBLICKEYBYTES, crypto_sign_ed25519_SECRETKEYBYTES, crypto_sign_ed25519_seed_keypair, crypto_sign_ed25519_SEEDBYTES, crypto_sign_ed25519_sk_to_seed, crypto_sign_ed25519_verify_detached, crypto_sign_ed25519ph_final_create, crypto_sign_ed25519ph_final_verify, crypto_sign_ed25519ph_init, crypto_sign_ed25519ph_STATEBYTES, crypto_sign_ed25519ph_update, crypto_sign_edwards25519sha512batch, crypto_sign_edwards25519sha512batch_keypair, crypto_sign_edwards25519sha512batch_open, crypto_sign_final_create, crypto_sign_final_verify, crypto_sign_init, crypto_sign_MESSAGEBYTES_MAX, crypto_sign_primitive, crypto_sign_STATEBYTES, crypto_sign_update, crypto_stream_chacha20_ietf_keygen, crypto_stream_chacha20_keygen, crypto_stream_keygen, crypto_stream_MESSAGEBYTES_MAX, crypto_stream_primitive, crypto_stream_salsa20, crypto_stream_salsa2012, crypto_stream_salsa2012_KEYBYTES, crypto_stream_salsa2012_keygen, crypto_stream_salsa2012_MESSAGEBYTES_MAX, crypto_stream_salsa2012_NONCEBYTES, crypto_stream_salsa2012_xor, crypto_stream_salsa208, crypto_stream_salsa208_KEYBYTES, crypto_stream_salsa208_keygen, crypto_stream_salsa208_MESSAGEBYTES_MAX, crypto_stream_salsa208_NONCEBYTES, crypto_stream_salsa208_xor, crypto_stream_salsa20_keygen, crypto_stream_xchacha20_keygen, crypto_stream_xsalsa20, crypto_stream_xsalsa20_KEYBYTES, crypto_stream_xsalsa20_keygen, crypto_stream_xsalsa20_MESSAGEBYTES_MAX, crypto_stream_xsalsa20_NONCEBYTES, crypto_stream_xsalsa20_xor, crypto_stream_xsalsa20_xor_ic, crypto_verify_16_BYTES, crypto_verify_32_BYTES, crypto_verify_64, crypto_verify_64_BYTES, randombytes, randombytes_close, randombytes_implementation_name, randombytes_internal_implementation, randombytes_set_implementation, randombytes_stir, randombytes_sysrandom_implementation, sodium_allocarray, sodium_base642bin, sodium_base64_encoded_len, sodium_bin2base64, sodium_bin2hex, sodium_hex2bin, sodium_init, sodium_library_minimal, sodium_library_version_major, sodium_library_version_minor, sodium_misuse, sodium_runtime_has_aesni, sodium_runtime_has_avx, sodium_runtime_has_avx2, sodium_runtime_has_avx512f, sodium_runtime_has_neon, sodium_runtime_has_pclmul, sodium_runtime_has_rdrand, sodium_runtime_has_sse2, sodium_runtime_has_sse3, sodium_runtime_has_sse41, sodium_runtime_has_ssse3, sodium_set_misuse_handler, sodium_stackzero, sodium_version_string

License

MIT

browser
cryptography
libsodium
nodejs
universal

holepunchto/sodium-universal

Universal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser

JavaScript

71

45 commits

updated Jan 9, 2026

See the code

README

sodium-universal

Universal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser

npm install sodium-universal

sodium-native ships with prebuilds for macOS, Windows, and Linux.

Note that the module itself is generated on a prepublish hook.

Usage

var sodium = require('sodium-universal')

var rnd = Buffer.allocUnsafe(12) // Cryptographically random data
sodium.randombytes_buf(rnd)

console.log(rnd.toString('hex'))

Works seamlessly with Node.js:

$ node example.js
c7dbd46a6cc84ff2e0d1285c

And the browser:

First install the peer dep, sodium-javascript.

npm install --save sodium-javascript

And then browserify

browserify example.js > bundle.js

Introduction

libsodium is a collection of cryptographic primitives, providing a low-level foundation to build higher-level cryptographic applications and protocols. It is often put in contrast to RSA based cryptography and OpenSSL, even though they all share overlapping algorithms and target slightly different audiences. Sodium is a collection of modern collection of primitives, fulfilling the same cryptographic tasks, but based on simpler and more efficient algorithms.

This library provides seamless bindings to sodium-native, which is the original C implementation of libsodium exposed as a Node native module. For the browser we expose sodium-javascript, using the package.json browser field, which is supported by most bundlers.

API

Please refer to sodium-native and sodium-javascript. Note that the two modules do not yet have feature parity, where sodium-native is the more featureful of the two.

Compatibilty

C Library Symbolsodium-nativesodium-javascript
crypto_aead_chacha20poly1305_ietf_ABYTES✅✅
crypto_aead_chacha20poly1305_ietf_decrypt✅✅
crypto_aead_chacha20poly1305_ietf_decrypt_detached✅✅
crypto_aead_chacha20poly1305_ietf_encrypt✅✅
crypto_aead_chacha20poly1305_ietf_encrypt_detached✅✅
crypto_aead_chacha20poly1305_ietf_KEYBYTES✅✅
crypto_aead_chacha20poly1305_ietf_keygen✅🔺
crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX✅✅
crypto_aead_chacha20poly1305_ietf_NPUBBYTES✅✅
crypto_aead_chacha20poly1305_ietf_NSECBYTES✅✅
crypto_aead_xchacha20poly1305_ietf_ABYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_decrypt✅🔺
crypto_aead_xchacha20poly1305_ietf_decrypt_detached✅🔺
crypto_aead_xchacha20poly1305_ietf_encrypt✅🔺
crypto_aead_xchacha20poly1305_ietf_encrypt_detached✅🔺
crypto_aead_xchacha20poly1305_ietf_KEYBYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_keygen✅🔺
crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX✅🔺
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES✅🔺
crypto_aead_xchacha20poly1305_ietf_NSECBYTES✅🔺
crypto_auth✅🔺
crypto_auth_BYTES✅🔺
crypto_auth_KEYBYTES✅🔺
crypto_auth_verify✅🔺
crypto_box_BEFORENMBYTES🔺✅
crypto_box_BOXZEROBYTES🔺✅
crypto_box_detached✅🔺
crypto_box_easy✅🔺
crypto_box_keypair✅✅
crypto_box_MACBYTES✅🔺
crypto_box_NONCEBYTES✅✅
crypto_box_open_detached✅🔺
crypto_box_open_easy✅🔺
crypto_box_PUBLICKEYBYTES✅✅
crypto_box_seal✅✅
crypto_box_seal_open✅✅
crypto_box_SEALBYTES✅✅
crypto_box_SECRETKEYBYTES✅✅
crypto_box_seed_keypair✅✅
crypto_box_SEEDBYTES✅✅
crypto_box_ZEROBYTES🔺✅
crypto_core_ed25519_add✅🔺
crypto_core_ed25519_BYTES✅🔺
crypto_core_ed25519_from_uniform✅🔺
crypto_core_ed25519_is_valid_point✅🔺
crypto_core_ed25519_NONREDUCEDSCALARBYTES✅🔺
crypto_core_ed25519_scalar_add✅🔺
crypto_core_ed25519_scalar_complement✅🔺
crypto_core_ed25519_scalar_invert✅🔺
crypto_core_ed25519_scalar_negate✅🔺
crypto_core_ed25519_scalar_random✅🔺
crypto_core_ed25519_scalar_reduce✅🔺
crypto_core_ed25519_scalar_sub✅🔺
crypto_core_ed25519_SCALARBYTES✅🔺
crypto_core_ed25519_sub✅🔺
crypto_core_ed25519_UNIFORMBYTES✅🔺
crypto_generichash✅✅
crypto_generichash_BYTES✅✅
crypto_generichash_BYTES_MAX✅✅
crypto_generichash_BYTES_MIN✅✅
crypto_generichash_final✅🔺
crypto_generichash_init✅🔺
crypto_generichash_KEYBYTES✅✅
crypto_generichash_KEYBYTES_MAX✅✅
crypto_generichash_KEYBYTES_MIN✅✅
crypto_generichash_keygen✅🔺
crypto_generichash_STATEBYTES✅🔺
crypto_generichash_update✅🔺
crypto_hash✅✅
crypto_hash_BYTES✅✅
crypto_hash_sha256✅✅
crypto_hash_sha256_BYTES✅✅
crypto_hash_sha256_final✅🔺
crypto_hash_sha256_init✅🔺
crypto_hash_sha256_STATEBYTES✅🔺
crypto_hash_sha256_update✅🔺
crypto_hash_sha512✅✅
crypto_hash_sha512_BYTES✅✅
crypto_hash_sha512_final✅🔺
crypto_hash_sha512_init✅🔺
crypto_hash_sha512_STATEBYTES✅🔺
crypto_hash_sha512_update✅🔺
crypto_kdf_BYTES_MAX✅✅
crypto_kdf_BYTES_MIN✅✅
crypto_kdf_CONTEXTBYTES✅✅
crypto_kdf_derive_from_key✅✅
crypto_kdf_KEYBYTES✅✅
crypto_kdf_keygen✅✅
crypto_kx_client_session_keys✅🔺
crypto_kx_keypair✅✅
crypto_kx_PUBLICKEYBYTES✅✅
crypto_kx_SECRETKEYBYTES✅✅
crypto_kx_seed_keypair✅✅
crypto_kx_SEEDBYTES✅✅
crypto_kx_server_session_keys✅🔺
crypto_kx_SESSIONKEYBYTES✅🔺
crypto_onetimeauth✅✅
crypto_onetimeauth_BYTES✅🔺
crypto_onetimeauth_final✅🔺
crypto_onetimeauth_init✅🔺
crypto_onetimeauth_KEYBYTES✅🔺
crypto_onetimeauth_STATEBYTES✅🔺
crypto_onetimeauth_update✅🔺
crypto_onetimeauth_verify✅✅
crypto_pwhash✅🔺
crypto_pwhash_BYTES_MAX✅🔺
crypto_pwhash_BYTES_MIN✅🔺
crypto_pwhash_SALTBYTES✅🔺
crypto_pwhash_scryptsalsa208sha256✅🔺
crypto_pwhash_scryptsalsa208sha256_BYTES_MAX✅🔺
crypto_pwhash_scryptsalsa208sha256_BYTES_MIN✅🔺
crypto_pwhash_scryptsalsa208sha256_SALTBYTES✅🔺
crypto_pwhash_scryptsalsa208sha256_str✅🔺
crypto_pwhash_scryptsalsa208sha256_str_needs_rehash✅🔺
crypto_pwhash_scryptsalsa208sha256_str_verify✅🔺
crypto_pwhash_scryptsalsa208sha256_STRBYTES✅🔺
crypto_pwhash_str✅🔺
crypto_pwhash_str_needs_rehash✅🔺
crypto_pwhash_str_verify✅🔺
crypto_pwhash_STRBYTES✅🔺
crypto_scalarmult✅✅
crypto_scalarmult_base✅✅
crypto_scalarmult_BYTES✅✅
crypto_scalarmult_ed25519✅🔺
crypto_scalarmult_ed25519_base✅🔺
crypto_scalarmult_ed25519_base_noclamp✅🔺
crypto_scalarmult_ed25519_BYTES✅🔺
crypto_scalarmult_ed25519_noclamp✅🔺
crypto_scalarmult_ed25519_SCALARBYTES✅🔺
crypto_scalarmult_SCALARBYTES✅✅
crypto_secretbox🔺✅
crypto_secretbox_BOXZEROBYTES🔺✅
crypto_secretbox_detached✅✅
crypto_secretbox_easy✅✅
crypto_secretbox_KEYBYTES✅✅
crypto_secretbox_MACBYTES✅✅
crypto_secretbox_NONCEBYTES✅✅
crypto_secretbox_open🔺✅
crypto_secretbox_open_detached✅✅
crypto_secretbox_open_easy✅✅
crypto_secretbox_ZEROBYTES🔺✅
crypto_secretstream_xchacha20poly1305_ABYTES✅🔺
crypto_secretstream_xchacha20poly1305_HEADERBYTES✅🔺
crypto_secretstream_xchacha20poly1305_init_pull✅🔺
crypto_secretstream_xchacha20poly1305_init_push✅🔺
crypto_secretstream_xchacha20poly1305_KEYBYTES✅🔺
crypto_secretstream_xchacha20poly1305_keygen✅🔺
crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX✅🔺
crypto_secretstream_xchacha20poly1305_pull✅🔺
crypto_secretstream_xchacha20poly1305_push✅🔺
crypto_secretstream_xchacha20poly1305_rekey✅🔺
crypto_secretstream_xchacha20poly1305_STATEBYTES✅🔺
crypto_shorthash✅✅
crypto_shorthash_BYTES✅✅
crypto_shorthash_KEYBYTES✅✅
crypto_sign✅✅
crypto_sign_BYTES✅✅
crypto_sign_detached✅✅
crypto_sign_ed25519_pk_to_curve25519✅🔺
crypto_sign_ed25519_sk_to_curve25519✅🔺
crypto_sign_ed25519_sk_to_pk✅🔺
crypto_sign_keypair✅✅
crypto_sign_open✅✅
crypto_sign_PUBLICKEYBYTES✅✅
crypto_sign_SECRETKEYBYTES✅✅
crypto_sign_seed_keypair✅✅
crypto_sign_SEEDBYTES✅✅
crypto_sign_verify_detached✅✅
crypto_stream✅✅
crypto_stream_chacha20✅✅
crypto_stream_chacha20_ietf✅✅
crypto_stream_chacha20_ietf_KEYBYTES✅✅
crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX✅✅
crypto_stream_chacha20_ietf_NONCEBYTES✅✅
crypto_stream_chacha20_ietf_xor✅✅
crypto_stream_chacha20_ietf_xor_ic✅✅
crypto_stream_chacha20_KEYBYTES✅✅
crypto_stream_chacha20_MESSAGEBYTES_MAX✅✅
crypto_stream_chacha20_NONCEBYTES✅✅
crypto_stream_chacha20_xor✅✅
crypto_stream_chacha20_xor_ic✅✅
crypto_stream_KEYBYTES✅✅
crypto_stream_NONCEBYTES✅✅
crypto_stream_salsa20_KEYBYTES✅🔺
crypto_stream_salsa20_MESSAGEBYTES_MAX✅🔺
crypto_stream_salsa20_NONCEBYTES✅🔺
crypto_stream_salsa20_xor✅🔺
crypto_stream_salsa20_xor_ic✅🔺
crypto_stream_xchacha20✅🔺
crypto_stream_xchacha20_KEYBYTES✅🔺
crypto_stream_xchacha20_MESSAGEBYTES_MAX✅🔺
crypto_stream_xchacha20_NONCEBYTES✅🔺
crypto_stream_xchacha20_xor✅🔺
crypto_stream_xchacha20_xor_ic✅🔺
crypto_stream_xor✅✅
crypto_verify_16🔺✅
crypto_verify_32🔺✅
randombytes_buf✅✅
randombytes_buf_deterministic✅🔺
randombytes_random✅🔺
randombytes_SEEDBYTES✅🔺
randombytes_uniform✅🔺
sodium_add✅🔺
sodium_compare✅🔺
sodium_free✅🔺
sodium_increment✅🔺
sodium_is_zero✅✅
sodium_malloc✅✅
sodium_memcmp✅✅
sodium_memzero✅✅
sodium_mlock✅🔺
sodium_mprotect_noaccess✅🔺
sodium_mprotect_readonly✅🔺
sodium_mprotect_readwrite✅🔺
sodium_munlock✅🔺
sodium_pad✅🔺
sodium_sub✅🔺
sodium_unpad✅🔺

Missing altogether (Ctrl + F friendly)

crypto_aead_aes256gcm_ABYTES, crypto_aead_aes256gcm_beforenm, crypto_aead_aes256gcm_decrypt, crypto_aead_aes256gcm_decrypt_afternm, crypto_aead_aes256gcm_decrypt_detached, crypto_aead_aes256gcm_decrypt_detached_afternm, crypto_aead_aes256gcm_encrypt, crypto_aead_aes256gcm_encrypt_afternm, crypto_aead_aes256gcm_encrypt_detached, crypto_aead_aes256gcm_encrypt_detached_afternm, crypto_aead_aes256gcm_is_available, crypto_aead_aes256gcm_KEYBYTES, crypto_aead_aes256gcm_keygen, crypto_aead_aes256gcm_MESSAGEBYTES_MAX, crypto_aead_aes256gcm_NPUBBYTES, crypto_aead_aes256gcm_NSECBYTES, crypto_aead_aes256gcm_STATEBYTES, crypto_aead_chacha20poly1305_ABYTES, crypto_aead_chacha20poly1305_decrypt, crypto_aead_chacha20poly1305_decrypt_detached, crypto_aead_chacha20poly1305_encrypt, crypto_aead_chacha20poly1305_encrypt_detached, crypto_aead_chacha20poly1305_KEYBYTES, crypto_aead_chacha20poly1305_keygen, crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX, crypto_aead_chacha20poly1305_NPUBBYTES, crypto_aead_chacha20poly1305_NSECBYTES, crypto_auth_hmacsha256, crypto_auth_hmacsha256_BYTES, crypto_auth_hmacsha256_final, crypto_auth_hmacsha256_init, crypto_auth_hmacsha256_KEYBYTES, crypto_auth_hmacsha256_keygen, crypto_auth_hmacsha256_STATEBYTES, crypto_auth_hmacsha256_update, crypto_auth_hmacsha256_verify, crypto_auth_hmacsha512, crypto_auth_hmacsha512256, crypto_auth_hmacsha512256_BYTES, crypto_auth_hmacsha512256_final, crypto_auth_hmacsha512256_init, crypto_auth_hmacsha512256_KEYBYTES, crypto_auth_hmacsha512256_keygen, crypto_auth_hmacsha512256_STATEBYTES, crypto_auth_hmacsha512256_update, crypto_auth_hmacsha512256_verify, crypto_auth_hmacsha512_BYTES, crypto_auth_hmacsha512_final, crypto_auth_hmacsha512_init, crypto_auth_hmacsha512_KEYBYTES, crypto_auth_hmacsha512_keygen, crypto_auth_hmacsha512_STATEBYTES, crypto_auth_hmacsha512_update, crypto_auth_hmacsha512_verify, crypto_auth_keygen, crypto_auth_primitive, crypto_box, crypto_box_afternm, crypto_box_beforenm, crypto_box_curve25519xchacha20poly1305_beforenm, crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES, crypto_box_curve25519xchacha20poly1305_detached, crypto_box_curve25519xchacha20poly1305_detached_afternm, crypto_box_curve25519xchacha20poly1305_easy, crypto_box_curve25519xchacha20poly1305_easy_afternm, crypto_box_curve25519xchacha20poly1305_keypair, crypto_box_curve25519xchacha20poly1305_MACBYTES, crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX, crypto_box_curve25519xchacha20poly1305_NONCEBYTES, crypto_box_curve25519xchacha20poly1305_open_detached, crypto_box_curve25519xchacha20poly1305_open_detached_afternm, crypto_box_curve25519xchacha20poly1305_open_easy, crypto_box_curve25519xchacha20poly1305_open_easy_afternm, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES, crypto_box_curve25519xchacha20poly1305_seal, crypto_box_curve25519xchacha20poly1305_seal_open, crypto_box_curve25519xchacha20poly1305_SEALBYTES, crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES, crypto_box_curve25519xchacha20poly1305_seed_keypair, crypto_box_curve25519xchacha20poly1305_SEEDBYTES, crypto_box_curve25519xsalsa20poly1305, crypto_box_curve25519xsalsa20poly1305_afternm, crypto_box_curve25519xsalsa20poly1305_beforenm, crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES, crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES, crypto_box_curve25519xsalsa20poly1305_keypair, crypto_box_curve25519xsalsa20poly1305_MACBYTES, crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES, crypto_box_curve25519xsalsa20poly1305_open, crypto_box_curve25519xsalsa20poly1305_open_afternm, crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES, crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES, crypto_box_curve25519xsalsa20poly1305_seed_keypair, crypto_box_curve25519xsalsa20poly1305_SEEDBYTES, crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, crypto_box_detached_afternm, crypto_box_easy_afternm, crypto_box_MESSAGEBYTES_MAX, crypto_box_open, crypto_box_open_afternm, crypto_box_open_detached_afternm, crypto_box_open_easy_afternm, crypto_box_primitive, crypto_core_ed25519_from_hash, crypto_core_ed25519_HASHBYTES, crypto_core_ed25519_random, crypto_core_ed25519_scalar_mul, crypto_core_hchacha20, crypto_core_hchacha20_CONSTBYTES, crypto_core_hchacha20_INPUTBYTES, crypto_core_hchacha20_KEYBYTES, crypto_core_hchacha20_OUTPUTBYTES, crypto_core_hsalsa20, crypto_core_hsalsa20_CONSTBYTES, crypto_core_hsalsa20_INPUTBYTES, crypto_core_hsalsa20_KEYBYTES, crypto_core_hsalsa20_OUTPUTBYTES, crypto_core_ristretto255_add, crypto_core_ristretto255_BYTES, crypto_core_ristretto255_from_hash, crypto_core_ristretto255_HASHBYTES, crypto_core_ristretto255_is_valid_point, crypto_core_ristretto255_NONREDUCEDSCALARBYTES, crypto_core_ristretto255_random, crypto_core_ristretto255_scalar_add, crypto_core_ristretto255_scalar_complement, crypto_core_ristretto255_scalar_invert, crypto_core_ristretto255_scalar_mul, crypto_core_ristretto255_scalar_negate, crypto_core_ristretto255_scalar_random, crypto_core_ristretto255_scalar_reduce, crypto_core_ristretto255_scalar_sub, crypto_core_ristretto255_SCALARBYTES, crypto_core_ristretto255_sub, crypto_core_salsa20, crypto_core_salsa2012, crypto_core_salsa2012_CONSTBYTES, crypto_core_salsa2012_INPUTBYTES, crypto_core_salsa2012_KEYBYTES, crypto_core_salsa2012_OUTPUTBYTES, crypto_core_salsa208, crypto_core_salsa208_CONSTBYTES, crypto_core_salsa208_INPUTBYTES, crypto_core_salsa208_KEYBYTES, crypto_core_salsa208_OUTPUTBYTES, crypto_core_salsa20_CONSTBYTES, crypto_core_salsa20_INPUTBYTES, crypto_core_salsa20_KEYBYTES, crypto_core_salsa20_OUTPUTBYTES, crypto_generichash_blake2b, crypto_generichash_blake2b_BYTES, crypto_generichash_blake2b_BYTES_MAX, crypto_generichash_blake2b_BYTES_MIN, crypto_generichash_blake2b_final, crypto_generichash_blake2b_init, crypto_generichash_blake2b_init_salt_personal, crypto_generichash_blake2b_KEYBYTES, crypto_generichash_blake2b_KEYBYTES_MAX, crypto_generichash_blake2b_KEYBYTES_MIN, crypto_generichash_blake2b_keygen, crypto_generichash_blake2b_PERSONALBYTES, crypto_generichash_blake2b_salt_personal, crypto_generichash_blake2b_SALTBYTES, crypto_generichash_blake2b_STATEBYTES, crypto_generichash_blake2b_update, crypto_generichash_primitive, crypto_hash_primitive, crypto_kdf_blake2b_BYTES_MAX, crypto_kdf_blake2b_BYTES_MIN, crypto_kdf_blake2b_CONTEXTBYTES, crypto_kdf_blake2b_derive_from_key, crypto_kdf_blake2b_KEYBYTES, crypto_kdf_primitive, crypto_kx_primitive, crypto_onetimeauth_keygen, crypto_onetimeauth_poly1305, crypto_onetimeauth_poly1305_BYTES, crypto_onetimeauth_poly1305_final, crypto_onetimeauth_poly1305_init, crypto_onetimeauth_poly1305_KEYBYTES, crypto_onetimeauth_poly1305_keygen, crypto_onetimeauth_poly1305_STATEBYTES, crypto_onetimeauth_poly1305_update, crypto_onetimeauth_poly1305_verify, crypto_onetimeauth_primitive, crypto_pwhash_alg_argon2i13, crypto_pwhash_alg_argon2id13, crypto_pwhash_alg_default, crypto_pwhash_argon2i, crypto_pwhash_argon2i_alg_argon2i13, crypto_pwhash_argon2i_BYTES_MAX, crypto_pwhash_argon2i_BYTES_MIN, crypto_pwhash_argon2i_memlimit_interactive, crypto_pwhash_argon2i_memlimit_max, crypto_pwhash_argon2i_memlimit_min, crypto_pwhash_argon2i_memlimit_moderate, crypto_pwhash_argon2i_memlimit_sensitive, crypto_pwhash_argon2i_opslimit_interactive, crypto_pwhash_argon2i_opslimit_max, crypto_pwhash_argon2i_opslimit_min, crypto_pwhash_argon2i_opslimit_moderate, crypto_pwhash_argon2i_opslimit_sensitive, crypto_pwhash_argon2i_passwd_max, crypto_pwhash_argon2i_passwd_min, crypto_pwhash_argon2i_SALTBYTES, crypto_pwhash_argon2i_str, crypto_pwhash_argon2i_str_needs_rehash, crypto_pwhash_argon2i_str_verify, crypto_pwhash_argon2i_STRBYTES, crypto_pwhash_argon2i_strprefix, crypto_pwhash_argon2id, crypto_pwhash_argon2id_alg_argon2id13, crypto_pwhash_argon2id_BYTES_MAX, crypto_pwhash_argon2id_BYTES_MIN, crypto_pwhash_argon2id_memlimit_interactive, crypto_pwhash_argon2id_memlimit_max, crypto_pwhash_argon2id_memlimit_min, crypto_pwhash_argon2id_memlimit_moderate, crypto_pwhash_argon2id_memlimit_sensitive, crypto_pwhash_argon2id_opslimit_interactive, crypto_pwhash_argon2id_opslimit_max, crypto_pwhash_argon2id_opslimit_min, crypto_pwhash_argon2id_opslimit_moderate, crypto_pwhash_argon2id_opslimit_sensitive, crypto_pwhash_argon2id_passwd_max, crypto_pwhash_argon2id_passwd_min, crypto_pwhash_argon2id_SALTBYTES, crypto_pwhash_argon2id_str, crypto_pwhash_argon2id_str_needs_rehash, crypto_pwhash_argon2id_str_verify, crypto_pwhash_argon2id_STRBYTES, crypto_pwhash_argon2id_strprefix, crypto_pwhash_memlimit_interactive, crypto_pwhash_memlimit_max, crypto_pwhash_memlimit_min, crypto_pwhash_memlimit_moderate, crypto_pwhash_memlimit_sensitive, crypto_pwhash_opslimit_interactive, crypto_pwhash_opslimit_max, crypto_pwhash_opslimit_min, crypto_pwhash_opslimit_moderate, crypto_pwhash_opslimit_sensitive, crypto_pwhash_passwd_max, crypto_pwhash_passwd_min, crypto_pwhash_primitive, crypto_pwhash_scryptsalsa208sha256_ll, crypto_pwhash_scryptsalsa208sha256_memlimit_interactive, crypto_pwhash_scryptsalsa208sha256_memlimit_max, crypto_pwhash_scryptsalsa208sha256_memlimit_min, crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive, crypto_pwhash_scryptsalsa208sha256_opslimit_interactive, crypto_pwhash_scryptsalsa208sha256_opslimit_max, crypto_pwhash_scryptsalsa208sha256_opslimit_min, crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive, crypto_pwhash_scryptsalsa208sha256_passwd_max, crypto_pwhash_scryptsalsa208sha256_passwd_min, crypto_pwhash_scryptsalsa208sha256_strprefix, crypto_pwhash_str_alg, crypto_pwhash_strprefix, crypto_scalarmult_curve25519, crypto_scalarmult_curve25519_base, crypto_scalarmult_curve25519_BYTES, crypto_scalarmult_curve25519_SCALARBYTES, crypto_scalarmult_primitive, crypto_scalarmult_ristretto255, crypto_scalarmult_ristretto255_base, crypto_scalarmult_ristretto255_BYTES, crypto_scalarmult_ristretto255_SCALARBYTES, crypto_secretbox_keygen, crypto_secretbox_MESSAGEBYTES_MAX, crypto_secretbox_primitive, crypto_secretbox_xchacha20poly1305_detached, crypto_secretbox_xchacha20poly1305_easy, crypto_secretbox_xchacha20poly1305_KEYBYTES, crypto_secretbox_xchacha20poly1305_MACBYTES, crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX, crypto_secretbox_xchacha20poly1305_NONCEBYTES, crypto_secretbox_xchacha20poly1305_open_detached, crypto_secretbox_xchacha20poly1305_open_easy, crypto_secretbox_xsalsa20poly1305, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES, crypto_secretbox_xsalsa20poly1305_KEYBYTES, crypto_secretbox_xsalsa20poly1305_keygen, crypto_secretbox_xsalsa20poly1305_MACBYTES, crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_secretbox_xsalsa20poly1305_NONCEBYTES, crypto_secretbox_xsalsa20poly1305_open, crypto_secretbox_xsalsa20poly1305_ZEROBYTES, crypto_secretstream_xchacha20poly1305_tag_final, crypto_secretstream_xchacha20poly1305_tag_message, crypto_secretstream_xchacha20poly1305_tag_push, crypto_secretstream_xchacha20poly1305_tag_rekey, crypto_shorthash_keygen, crypto_shorthash_primitive, crypto_shorthash_siphash24, crypto_shorthash_siphash24_BYTES, crypto_shorthash_siphash24_KEYBYTES, crypto_shorthash_siphashx24, crypto_shorthash_siphashx24_BYTES, crypto_shorthash_siphashx24_KEYBYTES, crypto_sign_ed25519, crypto_sign_ed25519_BYTES, crypto_sign_ed25519_detached, crypto_sign_ed25519_keypair, crypto_sign_ed25519_MESSAGEBYTES_MAX, crypto_sign_ed25519_open, crypto_sign_ed25519_PUBLICKEYBYTES, crypto_sign_ed25519_SECRETKEYBYTES, crypto_sign_ed25519_seed_keypair, crypto_sign_ed25519_SEEDBYTES, crypto_sign_ed25519_sk_to_seed, crypto_sign_ed25519_verify_detached, crypto_sign_ed25519ph_final_create, crypto_sign_ed25519ph_final_verify, crypto_sign_ed25519ph_init, crypto_sign_ed25519ph_STATEBYTES, crypto_sign_ed25519ph_update, crypto_sign_edwards25519sha512batch, crypto_sign_edwards25519sha512batch_keypair, crypto_sign_edwards25519sha512batch_open, crypto_sign_final_create, crypto_sign_final_verify, crypto_sign_init, crypto_sign_MESSAGEBYTES_MAX, crypto_sign_primitive, crypto_sign_STATEBYTES, crypto_sign_update, crypto_stream_chacha20_ietf_keygen, crypto_stream_chacha20_keygen, crypto_stream_keygen, crypto_stream_MESSAGEBYTES_MAX, crypto_stream_primitive, crypto_stream_salsa20, crypto_stream_salsa2012, crypto_stream_salsa2012_KEYBYTES, crypto_stream_salsa2012_keygen, crypto_stream_salsa2012_MESSAGEBYTES_MAX, crypto_stream_salsa2012_NONCEBYTES, crypto_stream_salsa2012_xor, crypto_stream_salsa208, crypto_stream_salsa208_KEYBYTES, crypto_stream_salsa208_keygen, crypto_stream_salsa208_MESSAGEBYTES_MAX, crypto_stream_salsa208_NONCEBYTES, crypto_stream_salsa208_xor, crypto_stream_salsa20_keygen, crypto_stream_xchacha20_keygen, crypto_stream_xsalsa20, crypto_stream_xsalsa20_KEYBYTES, crypto_stream_xsalsa20_keygen, crypto_stream_xsalsa20_MESSAGEBYTES_MAX, crypto_stream_xsalsa20_NONCEBYTES, crypto_stream_xsalsa20_xor, crypto_stream_xsalsa20_xor_ic, crypto_verify_16_BYTES, crypto_verify_32_BYTES, crypto_verify_64, crypto_verify_64_BYTES, randombytes, randombytes_close, randombytes_implementation_name, randombytes_internal_implementation, randombytes_set_implementation, randombytes_stir, randombytes_sysrandom_implementation, sodium_allocarray, sodium_base642bin, sodium_base64_encoded_len, sodium_bin2base64, sodium_bin2hex, sodium_hex2bin, sodium_init, sodium_library_minimal, sodium_library_version_major, sodium_library_version_minor, sodium_misuse, sodium_runtime_has_aesni, sodium_runtime_has_avx, sodium_runtime_has_avx2, sodium_runtime_has_avx512f, sodium_runtime_has_neon, sodium_runtime_has_pclmul, sodium_runtime_has_rdrand, sodium_runtime_has_sse2, sodium_runtime_has_sse3, sodium_runtime_has_sse41, sodium_runtime_has_ssse3, sodium_set_misuse_handler, sodium_stackzero, sodium_version_string

License

MIT

browser
cryptography
libsodium
nodejs
universal

Project health

Latest release

5.0.1 · Apr 6, 2025

Releases this year

0