Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Chloride is a Cryptography Library (Cl) for javascript enviroments.
Chloride descends from Dan J. Bernstein's (djb) NaCl library ("Networking And Cryptography Library", not to be confused with the other NaCl, Google's Native Client). djb wrote NaCl, but did not maintain it, some ideas in the library (in particular the networking part) weren't really fully baked, and the best parts where taken and maintained as libsodium (although "Na" represents the element sodium, so they took the wrong part of the acronym).
Chloride is a compatibility layer that gives you bindings to libsodium when used in Node.js, and either the libsodium-wrappers which is libsodium compiled to JavaScript via emscripten if performance is important but code size isn't. Or, if you are not doing many crypto operations, it uses tweetnacl, which is a handwritten port, and 1/10 the size of libsodium-wrappers.
We have wrapped and tested enough functions for our crypto modules to work.
This is probably everything you need, NaCl doesn't have a very large API, so this is probably everything.
NaCl was written with performance in mind, unfortunately a lot of that is lost when you compile it to JavaScript. However, Chloride still has the fastest JavaScript elliptic curve signature that I am aware of (and asymmetric crypto is much slower than symmetric, so this is always the weak point).
If you are only doing a symmetric ciphers (crypto_box
) or a signature or two, then performance is probably not a problem. If you are verifying many signatures, performance may be a problem. Bear in mind that an asymetric operation (sign
, verify
, scalarmult
, keygen
) is usually 50 times slower than a symmetric operation, for instance a hash.
See sodiumperf performance comparisons.
To run Chloride in performance mode, load it like this:
const chloride = require('chloride')
To run in low size mode:
const chloride = require('chloride/small')
This only applies to enviroments that only support JavaScript. If you are running this on the server and could compile libsodium, then you have the same fast crypto either way.
MIT
FAQs
node.js sodium bindings + pure js polyfil
We found that chloride demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.