HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
jedisct1
libsodium
C2013–2023
jedisct1 / libsodium

libsodium

A modern, portable, easy to use crypto library.

51Distinct people
59Mentions
0Explicit recommenders
14.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A modern, portable, easy to use crypto library.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year59 dated mentions

Observed mentions: 2013-03-07 09:31:27 UTC to 2023-09-15 09:52:20 UTC.

0510152013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 13 mentions; 4 submissions, 9 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC303
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC1349
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC707
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC505
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC615
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC211
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC615
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC716
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC523

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Sodium is an easy-to-use software library that provides a wide range of cryptographic operations including encryption, decryption, digital signatures, and secure password hashing. It is a portable, cross-compilable, installable, and packageable fork of NaCl. While maintaining API compatibility, libsodium extends functionality to improve usability and simplify the development of secure applications. Key Features Encryption & Decryption: Securely encrypt and decrypt data with modern algorithms. Digital Signatures: Create and verify signatures to ensure data authenticity. Cross-Platform Compatibility: Supported on Windows (MinGW and Visual Studio, x86, x64 and arm64), iOS, Android, JavaScript, and WebAssembly. User-Friendly API: Designed to provide all core cryptographic operations while remaining easy to integrate into your projects. Documentation Installation Quickstart Full Documentation Releases Integrity Checking Versioning libsodium uses a two-tier release system: Point releases (e.g., 1.0.19, 1.0.20, 1.0.21) are tagged when new features are added or significant changes are made. Stable releases are frequent maintenance updates between point releases. They fix minor issues while remaining fully compatible with their parent point release. No new features, no breaking changes. If your application depends on a specific point release, stable updates are safe to apply. Security fixes go to the stable branch immediately, with a new point release tagged shortly after. Contributors Code Contributors This project thrives thanks to the valuable contributions from our community. View all the contributors: Financial Contributors Your financial support helps us sustain and further develop libsodium. Become a Financial Contributor Individuals Organizations Support libsodium with your organization and gain visibility through your logo and website link. Support with Your Organization License This project is distributed under the ISC license.
Read the full README on GitHub

What Hacker News says

59 sources
Libsodium has been around for a while, so probably the reason it was posted is that version 1.0.19 was just released: https://github.com/jedisct1/libsodium/releases/tag/1.0.19-RE... Updated NuGet and Swift packages are going to be uploaded soon. AEGIS-128X and 256X are not there yet, but if you need them, they are available in libaegis: https://github.com/jedisct1/libaegis All the code from libaegis will eventually be merged into libsodium, including the incremental update API which is especially useful for TLS.
In Libsodium: A modern, portable, easy to use crypto library
This article [0] has a good explanation of why clamping is necessary. But the process is very simple, you just generate 32 random bytes, clear the three least significant bits to avoid small-subgroup attacks, then clear the most significant bit and set the second most significant to avoid side-channel attacks which may occur if an implementation isn’t constant-time. The Libsodium source shows this pretty clearly: [1], lines 18-23. 0: https://www.jcraige.com/an-explainer-on-ed25519-clamping 1: https://github.com/jedisct1/libsodium/blob/master/src/libsod...
In Dangerous toys: Anything to ed25519 (SSH Keys)
I’m not sure what you mean by there being no public key cryptography here. In the Crypto constructor, a random secret key is generated, and then the generator for Curve25519 is scalar multiplied on the elliptic curve by this secret key to generate a public key. That’s the standard process for X25519 key generation, and it’s what Libsodium does to generate a secret key/public key pair [1]. To establish a shared secret session key, the standard ECDH procedure is used, as seen in Crypto::setRemotePublicKey, where we multiply the other party’s public key by our secret key on curve25519 to establish a shared secret. This shared secret is then used for encryption, since symmetric encryption is generally cheaper + more secure than asymmetric. I absolutely agree that this project needs a more formal cryptographic approach, and should be using a h
Read the rest
igher level construct (e.g: crypto_secretstream, also from libsodium), but as far as I can tell at first glance, this is a working implementation of X25519. 1: https://github.com/jedisct1/libsodium/blob/7993f5ec5199b6637...
In Show HN: LANDrop – A cross-platform AirDrop-like file transfer tool
I was thinking, surely the author might overstate this... then I looked at his biggest project, libsodium, and this is the second most recent bug https://github.com/jedisct1/libsodium/issues/1038 ``` invalid usage on desktop chrome when running crypto_pwhash Error: invalid usage at h (sodium.js:formatted:17589) at Object.qA [as crypto_pwhash] (sodium.js:formatted:19328) ``` (this is the whole issue, no more information provided.) OK I feel the author now.
In It Doesn't Work
TL;DR: this code should've never passed audit. I've found numerous problems, but I'll focus on the attack that lets someone successfully manipulate a ciphertext and have it successfully decrypt as something else. While the audit report says "Boxcryptor is not enforcing integrity [of ciphertexts]," this attack can let an adversary decrypt a (short) ciphertext, given a padding oracle. This company should've never rolled their own crypto in response to Authenticated Encryption, which has been solved, if you just use a pre-existing library. I'm surprised that this code has a "successful" audit. The cryptography _protocol_ that is implemented in the linked github repo (https://github.com/secomba/boxcryptor-single-file-decryptor) has several flaws (in addition to having some bad code practices that I'll skip over since this repo is supposed to
Read the rest
only document the encryption protocols). First, the authors' problems appear to stem from their choice to manually implement an unusual (and inefficient) construction of the Authenticated Encryption primitive. Authenticated Encryption is the most common crypto primitive that people when they say "they want encryption." It's placed front-and-center in libsodium, ring, mundane, tink, monocypher, and every modern cryptography library that I've seen, since it is such a common operation. Modern Authenticated Encryption constructions include: AES-GCM, (X)ChaCha20-Poly1305. While there exist others, the industry has converged on these two as the standard. These block cipher modes did not emerge for no reason. The cryptography community has steadily iterated on what the default should be when somebody asks, "how can I encrypt my file." We've arrived at these constructions, in particular, because previous constructions have had security flaws. The authors of this repo have chosen to use the following protocol (for decryptDataPBKDF2): 1. Derive two keys (KE, KH) from a password string using PBKDF2. KE is the encryption key used with AES, and KH is an HMAC key (used for multiple purposes, which is problematic). 2. Read the AES-CBC initialization vector, IV. Read the AES-CBC ciphertext, C. 3. Check HMAC(KH, C) == the tag in the file. 4. Output AES-CBC-DECRYPT(KE, IV, C) with PKCS#5 padding. The core of the problem is that, while they use the HMAC to check that the ciphertext is authentic (which is a bit odd, given that they seem to claim that authenticity shouldn't matter), they never check that the IV is authentic (it's never computed in the HMAC). The way that AES-CBC decryption works, for first 16-bytes of the decryption is AES-BLOCK-DECRYPT(KE, first 16 bytes of C) XOR IV. As a result, if the IV isn't authenticated (which it's not), then any bit that the attacker flips in the IV will flip the corresponding bit in the ciphertext. Because PKCS#5 padding is used, given a padding oracle, an adversary could decrypt messages under 16 bytes in length. The moral of the story is DO NOT ROLL YOUR OWN CRYPTO! Rolling your own crypto can be fun and educational and informative, but DON'T DEPLOY IT! This bug should not have arisen, because the GitHub link in this blog post should've been to https://github.com/google/tink or https://github.com/jedisct1/libsodium or some library like them.
In Independent Audit: Insights into the Source Code of Boxcryptor
brugeman·Nov 25, 2020Submission

Show HN: A file server for Android, end-to-end encryption, web access

Recently I've been playing with an idea of a file server on my Android phone, with a web browser access. I wanted to replace: - AirDroid - sending files to my own PC or laptop. - ShareIt - sending big files over the local network to my family devices. - Dropbox - sharing select files with other people over the Internet. Requirements I had in mind: - end-to-end encryption, no sign ups, no accounts, no passwords - local connection if devices are on the same network - asynchronous access, server should work seamlessly in the background This week I finally managed to stitch the pieces together and get something usable and useful. I now have full access to my phone on my laptop browser, I can share files with a link without uploading to the cloud, and the local network is used whenever possible. The file server app is on the PlayStore[1], web-
Read the rest
client is here[2], and you can check out the roadmap[3]. Shoutouts to these great tools that made it possible: - libsodium[4], and it's JS version, are used for the end-to-end encryption - StreamSaver.js[5], to save large files from a non-HTTP transport without buffering it in RAM. Had to patch it to add back pressure when the download is paused. Current limitations: - p2p only works on local networks, wait until WebRTC transport is implemented in the server - when downloading several files, a Zip is generated, with a 4Gb size limit, wait until I figure out the way to fix this. With a single file, it's downloaded in plain and without limits. Please roast this thing! -- [1] PlayStore: https://play.google.com/store/apps/details?id=im.recall.android [2] Web client: http://web.recall.im [3] Roadmap: https://recall.im [4] LibSodium: https://github.com/jedisct1/libsodium [5] StreamSaver.js: https://github.com/jimmywarting/StreamSaver.js [*] A demo of some files I shared, served by my phone: http://web.recall.im/#peer=c7e0f38a7f60752b4fa3017807fc731f2c8cb87b3d7d35c8131196c…
20 points · Open discussion
>I of course agree with all of this, but as someone pretty much at the bottom of the food chain who just wants to encrypt some data, there's often no libraries that safely glue the primitives together in the way that I require. >I hope this doesn't come off as entitled, but I feel like the best way to get people to stop rolling their own crypto is to provide more/better libraries. Author here. I mentioned libsodium [1] and Tink [2]. We started Tink because we want to provide more/better libraries. >Granted, this is getting better, for example NaCl's crypto_box[0] is awesome and very hard to misuse. But say you want forward secrecy now. chirp, tumbleweed. It looks like you want to build an interactive protocol. I'm not sure if libsodium has a solution, but Tink doesn't. So far we've been focusing on encryption at rest. Can you tell me more
Read the rest
In So you want to roll your own crypto?
Tink addresses things libsodium doesn't really do. Native support for AWS Key Management System and its equivalent on other cloud platforms is a huge win; we should all be using more of these. But libsodium would have to start mandating a TLS library and an HTTP library and whatnot, interfering with people's existing setups; you can't really do that without C programmers getting angry at you. It deals with not only key generation, but also key serialization. libsodium kind of strands you when it comes to the question how to actually store keys. Deterministic nonces have also been something that libsodium appears to have rejected: https://github.com/jedisct1/libsodium/issues/392 If you're looking at it from a misuse-prevention perspective, Tink is probably a major step up that accounts for modern use cases. libsodium's kind of in a lower l
Read the rest
evel niche and suffers from being held back by C and its notoriously anemic standard library.
In Tink – Cryptographic APIs that are secure, easy to use correctly
Speaking vaguely of this topic, the ciphersuite of WireGuard: How much trouble do you think it would be for a CPU designer to include a ChaCha20 accelerator or some sort of round/double-round/quarter-round³ primitive? It seems like the cost would be an order of magnitude lower than something like an AES accelerator, and way easier to validate. I keep wondering if it's going to be this year, the next, or the one after that; but ChaCha20† is getting really popular, so I can imagine something like this could be very valuable, especially on a chip for an infrastructure provider like CloudFlare‡ , or any VPN megacompany. † which may have more rounds than necessary, good reason not to do all 20 in one primitive if that costs latency/throughput ‡ who use ChaCha-based TLS for devices with poor, nonexistent, or misconfigured AES accel. ³ this rela
Read the rest
In Why not “Why not WireGuard?”
> So yes, like I said, you can force a particular behavior, and throw out any system for which that doesn't come naturally Find me one system in current use (2020) that isn't 2's complement. > you just made the language more complex for them. Ah, but I was never talking about implementation complexity. I was talking about specification complexity. Imposing 2's complement makes the specification simpler. No special case, no boundary. Just a binary field. Undefined behaviour draws such a boundary. An extra detail to specify and remember. Some thing that reminds you you're not quite doing modular arithmetic. > Eh. You did nothing about undefined behavior. It's still there. I did. There's less of it. I've filled the bug, here's what's this about: https://github.com/jedisct1/libsodium/issues/937 Here's the relevant quote from annex J of the (h
Read the rest
eavy, I have printed it) C99 specifications: Addition or subtraction of a pointer into, or just beyond, an array object and an integer type produces a result that does not point into, or just beyond, the same array object. (6.5.6) That's what caused the bug: we were taking a pointer from an array, then used it to overflow past it. It didn't matter that we could access the memory there. What mattered is that we locally overflew that array. Had we computed the pointer by first working with the outer array, then pointed to the right element, we'd have the same pointer, except this time it wouldn't be undefined. Bonus note: you don't even have to dereference the pointer, computing its value is enough to trigger undefined behaviour. Here is some more undefined behaviour I have removed (it's subtle, relatively few programmers know this): Pointers that do not point into, or just beyond, the same array object are subtracted. (6.5.6) There go flat memory models. Though to be honest, even segmented memory models could define that. Just make the subtraction already, it doesn't have to mean anything. Make it unspecified or implementation defined at least. Pointers that do not point to the same aggregate or union (nor just beyond the same array object) are compared using relational operators (6.5.8) That's the reason we can't implement memmove() portably and efficiently. And depending which tool you ask, even converting the pointers to intptr_t first isn't enough. Real world example here: https://github.com/jedisct1/libsodium/commit/e7e378fad116c18... --- If you haven't already, go read the annex J from the C standard. Ponder the fact that compilers, unless you specifically ask not to (-fwrapv), will exploit every single one, even on platform that could define some reasonable behaviour (2's complement machines). It may hint at how hostile C is to programmers who care about correctness. Believe me, I know. I wrote a whole Crypto library[1], and that's one of the easiest things to get right, where C is concerned. I mean, the crypto itself is hard, but the total lack of dependency makes it pathologically easy to write in a portable way. Yet C still makes it hard. [1] https://monocypher.org
In Why I’m Using C

Showing the 15 most recent of 59 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.