#libsodium #binding

sys libsodium-ffi

Native bindings (FFI) to the libsodium library

17 releases

0.2.2 Dec 7, 2019
0.1.17 Apr 26, 2019
0.1.15 Feb 14, 2019
0.1.12 Jun 27, 2018
0.1.9 Oct 8, 2017

#645 in Cryptography

Download history 192/week @ 2022-05-31 104/week @ 2022-06-07 119/week @ 2022-06-14 189/week @ 2022-06-21 83/week @ 2022-06-28 71/week @ 2022-07-05 105/week @ 2022-07-12 68/week @ 2022-07-19 139/week @ 2022-07-26 98/week @ 2022-08-02 62/week @ 2022-08-09 50/week @ 2022-08-16 83/week @ 2022-08-23 57/week @ 2022-08-30 136/week @ 2022-09-06 145/week @ 2022-09-13

429 downloads per month
Used in ursa

MIT/ISC license

20KB
414 lines

libsodium-ffi

Build Status Build status

Rust native binding to libsodium

# Cargo.toml
[dependencies]
libsodium-ffi = "0.2"

Usage

Environement variables

  • SODIUM_LIB_DIR=/path/to/libsodium for telling cargo where to find libsodium (Work with SODIUM_INCLUDE_DIR)

  • SODIUM_INCLUDE_DIR=/path/to/libsodium/include for telling bindgen where to find libsodium's headers (Work with SODIUM_LIB_DIR)

  • SODIUM_STATIC=yes for telling cargo to static-link libsodium

  • SODIUM_BUILD_STATIC=yes force build from source instead of trying to find libsodium in system-wide

Examples

## Specify paths by hand
# This is the path to the directory of `/usr/local/lib/libsodium.a`
export SODIUM_LIB_DIR=/usr/local/lib
# This is the path to the directory of `/usr/local/include/sodium.h`
export SODIUM_INCLUDE_DIR=/usr/local/include

## Uses system-wide libsodium
# Statically link system-wide libsodium
export SODIUM_STATIC=yes

## Build libsodium from source
export SODIUM_BUILD_STATIC=yes

Thanks

  • build.rs is partially borrowed from rust_sodium project.

Dependencies

~0–3.5MB
~68K SLoC