The sodium cryptography library compiled to WebAssembly and pure JavaScript for use in web applications and Node.js.
libsodium.js is a JavaScript and WebAssembly port of the libsodium cryptography library, providing a complete suite of cryptographic primitives for web and Node.js applications. It solves the problem of implementing secure cryptography in JavaScript environments by offering battle-tested algorithms with a simple API. The library includes authenticated encryption, hashing, signatures, password hashing, and more, all compiled to run efficiently in browsers and servers.
Web developers and Node.js developers who need to implement cryptography in their applications, including those building end-to-end encrypted web apps, secure authentication systems, or privacy-focused tools.
Developers choose libsodium.js because it provides the reliability and security of the widely-audited libsodium C library in a JavaScript-friendly package, with automatic WebAssembly fallbacks for performance and comprehensive browser compatibility. Its identical API to the C library reduces learning curve and ensures consistent behavior across platforms.
libsodium compiled to Webassembly and pure JavaScript, with convenient wrappers.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Compiled with Emscripten to WebAssembly, it offers near-native speed for crypto operations in browsers, with automatic fallback to pure JavaScript for broad compatibility.
Wrappers expose the same API as the C libsodium, ensuring consistency and reducing learning curve for developers familiar with the original library.
Works in Chrome ≥16, Firefox ≥21, Safari ≥6, Edge ≥0.11, Node.js, and Bun, making it viable for both client and server-side applications.
Provides utilities like base64/hex/string conversion, constant-time comparisons, and memory zeroing, simplifying common cryptographic tasks.
The standard version is 290 KB gzipped, and sumo is 375 KB, which can significantly impact web application load times and bandwidth usage.
Cryptographic functions are only available after resolving the .ready promise, adding complexity and potential delays in application startup.
Core cryptographic functions cannot be imported as named exports; they must be accessed via the default export, conflicting with modern ES module patterns.