apotocki/libsodium
Sodium, a modern, easy-to-use library for encryption, decryption, signatures, password hashing and more.
- Library
- libsodium
- Newest
- 1.0.22 (r1, android)
- Targets
- android, apple, linux, windows
- License
- ISC
- Homepage
- https://libsodium.org
- Documentation
- https://doc.libsodium.org
- Keywords
- crypto, cryptography, encryption, signatures, nacl
Use it
In otok.toml:
[deps.libsodium]
recipe = "apotocki/libsodium"
version = "~> 1.0.22"
Versions
| Version | Target | Channel | Published | Status |
|---|---|---|---|---|
| 1.0.22 (r1, android) | android | stable | 2026-11-10 | |
| 1.0.22 (r1, apple) | apple | stable | 2026-11-10 | |
| 1.0.22 (r1, linux) | linux | stable | 2026-11-10 | |
| 1.0.22 (r1, windows) | windows | stable | 2026-11-10 |
1.0.22 (r1, android)
Platforms
android
Toolchains
make { default-recipe = "apotocki/make", version = ">= 3.81" }
Recipe files
build.lua
-- libsodium's own configure and make, the library only. What it installs: libsodium.a, or libsodium.so.
function build(slice, options, deps)
local t = slice.toolchain
-- the target in CC itself: libtool passes no --target of the flags to the link of a shared object, which clang
-- would then link for the build machine, without Android's libc
local env = { CC = t.cc .. " --target=" .. slice.triple, CXX = t.cxx .. " --target=" .. slice.triple }
-- --disable-pie: position-independent executables are for libsodium's tests, not the library
otok.autotools{ args = { "--disable-pie" }, env = env }
local p = slice.prefix
local lib = p .. (slice.linkage == "static" and "/lib/libsodium.a" or "/lib/libsodium.so")
return { libraries = { sodium = lib }, headers = p .. "/include" }
end
recipe.toml
# The otok recipe of libsodium (https://github.com/apotocki/otok): libsodium for Android, from the release archive, with
# its own configure; static or dynamic.
[recipe]
api = 1
library = "libsodium"
name = "libsodium"
version = "1.0.22"
revision = 1
license = "ISC"
license-files = ["LICENSE"]
homepage = "https://libsodium.org"
documentation = "https://doc.libsodium.org"
description = "Sodium, a modern, easy-to-use library for encryption, decryption, signatures, password hashing and more."
keywords = ["crypto", "cryptography", "encryption", "signatures", "nacl"]
linkage = ["static", "dynamic"]
# The archive of the release, signed with minisign by libsodium's key RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3
# (libsodium-1.0.22.tar.gz.minisig); the same file is an asset of the release on GitHub.
[source]
url = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.22.tar.gz"
sha256 = "adbdd8f16149e81ac6078a03aca6fc03b592b89ef7b5ed83841c086191be3349"
mirrors = ["https://github.com/jedisct1/libsodium/releases/download/1.0.22-RELEASE/libsodium-1.0.22.tar.gz"]
[platforms]
supported = ["android"]
build-on = ["*/ndk"]
[toolchains]
make = { version = ">= 3.81", default-recipe = "apotocki/make" }
[[product]]
name = "Sodium"
libraries = ["sodium"]