{"id":13438854,"url":"https://github.com/sodiumoxide/sodiumoxide","last_synced_at":"2025-03-20T06:31:39.096Z","repository":{"id":722430,"uuid":"14966465","full_name":"sodiumoxide/sodiumoxide","owner":"sodiumoxide","description":"[DEPRECATED] Sodium Oxide: Fast cryptographic library for Rust (bindings to libsodium)","archived":true,"fork":false,"pushed_at":"2022-09-03T20:22:14.000Z","size":16023,"stargazers_count":640,"open_issues_count":0,"forks_count":173,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-08-11T17:08:14.424Z","etag":null,"topics":["bindings","cryptography","cryptography-library","deprecated","deprecated-library","libsodium"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sodiumoxide.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-05T21:37:53.000Z","updated_at":"2024-07-04T08:18:29.000Z","dependencies_parsed_at":"2022-08-06T10:00:38.976Z","dependency_job_id":null,"html_url":"https://github.com/sodiumoxide/sodiumoxide","commit_stats":null,"previous_names":["dnaq/sodiumoxide"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodiumoxide%2Fsodiumoxide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodiumoxide%2Fsodiumoxide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodiumoxide%2Fsodiumoxide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodiumoxide%2Fsodiumoxide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sodiumoxide","download_url":"https://codeload.github.com/sodiumoxide/sodiumoxide/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244565563,"owners_count":20473293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","cryptography","cryptography-library","deprecated","deprecated-library","libsodium"],"created_at":"2024-07-31T03:01:09.009Z","updated_at":"2025-03-20T06:31:34.089Z","avatar_url":"https://github.com/sodiumoxide.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","Rust","库","Cryptography"],"sub_categories":["Cryptography","密码学 Cryptography","加密","Collection library"],"readme":"[DEPRECATED]\n\nThis project has reached the end of its development as a cryptographic library\nfor rust. Feel free to browse the code, and feel free to use it, but it will\nnot see any more updates (unless a security issue arises, those will be fixed).\n\nThe cryptographic landscape of rust has vastly changed since this library was\nintroduced to the community, and we believe that if you need a featureset that\ngoes beyond what this library delivers there are other libraries that would\nwork well.\n\nIt's been fun, but the last couple of years I haven't been able to give this\nlibrary the attention I feel that it deserves, so now it's time to formally\ndeprecate it.\n\n\n# sodiumoxide\n\n|Crate|Documentation|Gitter|\n|:---:|:-----------:|:--------:|:-----:|:------:|:----:|\n|[![Crates.io][crates-badge]][crates-url]|[![Docs][doc-badge]][doc-url]|[![Gitter][gitter-badge]][gitter-url]|\n\n[crates-badge]: https://img.shields.io/crates/v/sodiumoxide.svg\n[crates-url]: https://crates.io/crates/sodiumoxide\n[doc-badge]: https://docs.rs/sodiumoxide/badge.svg\n[doc-url]: https://docs.rs/sodiumoxide\n[gitter-badge]: https://badges.gitter.im/rust-sodiumoxide/Lobby.svg\n[gitter-url]: https://gitter.im/rust-sodiumoxide/Lobby\n\n\u003e [NaCl](http://nacl.cr.yp.to) (pronounced \"salt\") is a new easy-to-use high-speed software library for network communication, encryption, decryption, signatures, etc. NaCl's goal is to provide all of the core operations needed to build higher-level cryptographic tools.\n\u003e Of course, other libraries already exist for these core operations. NaCl advances the state of the art by improving security, by improving usability, and by improving speed.\n\n\u003e [Sodium](https://github.com/jedisct1/libsodium) is a portable, cross-compilable, installable, packageable fork of NaCl (based on the latest released upstream version nacl-20110221), with a compatible API.\n\nThis package aims to provide a type-safe and efficient Rust binding that's just\nas easy to use.\nRust \u003e= 1.36.0 is required because of mem::MaybeUninit.\n\n## Basic usage\n\n### Cloning\n```\ngit clone https://github.com/sodiumoxide/sodiumoxide.git\ncd sodiumoxide\ngit submodule update --init --recursive\n```\n\n### Building\n```\ncargo build\n```\n\n### Testing\n```\ncargo test\n```\n\n### Documentation\n```\ncargo doc\n```\n\nDocumentation will be generated in target/doc/...\n\nMost documentation is taken from NaCl, with minor modification where the API\ndiffers between the C and Rust versions.\n\n### Support for the AES AEAD Variant\n\nThe AES AEAD variant `crypto_aead_aes256gcm` requires hardware support for the\n`AES` and `CLMUL` instruction set extensions to x86; you can read why that's the\ncase\n[here](https://doc.libsodium.org/secret-key_cryptography/aead/aes-256-gcm#limitations). These instruction set extensions were first made\navailable in Intel Westmere (early 2010) and at the time of writing x86 hardware\nsupport for them is near universal.\n\nLibsodium exposes an API for runtime feature detection and doesn't prevent\nyou from calling `crypto_aead_aes256gcm` on a machine lacking `AES` and\n`CMUL` expressions; doing so will result in a runtime `SIGILL` (illegal\ninstruction). By contrast sodiumoxide exposes an API that precludes the use of\nthe `crypto_aead_aes256gcm_*` family of functions without performing the runtime\ncheck. It's important to note that the use of `sodiumoxide::init()` is mandatory\nwhen using AES; unless you call `init` calls `aead::aes256gcm::Aes256Gcm::new()`\nwill always return `Err(_)` even if your runtime hardware supports AES.\n\n## Dependencies\n\nC compiler (`cc`, `clang`, ...) must be installed in order to build libsodium from source.\n\n## Extended usage\n\nThis project contains a snapshot of libsodium and builds it by default, favouring a statically-built, fixed version of the native library.\n\nAlthough it is highly recommended to use the default way with the pinned version, there are several ways you may want to use this crate:\n* link it against the library installed on your system\n* link it against a precompiled library that you built on your own\n\nYou can do this by setting environment variables.\n\n|Name|Description|Example value|Notes|\n| :- | :-------- | :---------- | :-- |\n|`SODIUM_LIB_DIR`|Where to find a precompiled library|`/usr/lib/x86_64-linux-gnu/`|The value should be set to the directory containing `.so`,`.a`,`.la`,`.dll` or `.lib`|\n|`SODIUM_SHARED`|Tell `rustc` to link the library dynamically|`1`|Works only with `SODIUM_LIB_DIR`. We check only the presence|\n|`SODIUM_USE_PKG_CONFIG`|Tell build.rs to find system library using pkg-config|`1`|We check only the presence|\n|`SODIUM_DISABLE_PIE`|Build with `--disable-pie`|`1`|Certain situations may require building libsodium configured with `--disable-pie`. Useful for !Windows only and when building libsodium from source. We check only the presence|\n\n### Examples on *nix\n\n#### Using pkg-config\n\n(Ubuntu: `apt install pkg-config`, OSX: `brew install pkg-config`, ...)\n\n```\nexport SODIUM_USE_PKG_CONFIG=1\ncargo build\n```\n\n#### Using precompiled library\n\nSee https://download.libsodium.org/doc/installation.\n\n```\nexport SODIUM_LIB_DIR=/home/user/libsodium-1.0.18/release/lib/\nexport SODIUM_SHARED=1\ncargo build\n```\n\n## Optional features\n\nSeveral [optional features](http://doc.crates.io/manifest.html#usage-in-end-products) are available:\n\n* `std` (default: **enabled**). When this feature is disabled,\n  sodiumoxide builds using `#![no_std]`. Some functionality may be lost.\n\n* `serde` (default: **enabled**). Allows serialization and deserialization of\n  keys, authentication tags, etc. using the\n  [serde library](https://crates.io/crates/serde).\n\n* `benchmarks` (default: **disabled**). Compile benchmark tests. Requires a\n  nightly build of Rust.\n\n## Cross-Compiling\n\n### Cross-Compiling for armv7-unknown-linux-gnueabihf\n\n1. Install dependencies and toolchain:\n\n```\nsudo apt update\nsudo apt install build-essential gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross -y\nrustup target add armv7-unknown-linux-gnueabihf\n```\n\n2. Add the following to a [.cargo/config file](http://doc.crates.io/config.html):\n\n```\n[target.armv7-unknown-linux-gnueabihf]\nlinker = \"arm-linux-gnueabihf-gcc\"\n```\n\n3. Build by running:\n\n```\ncargo build --release --target armv7-unknown-linux-gnueabihf\n```\n\n### Cross-Compiling for armv7-unknown-linux-musleabihf via docker\n\n1. cargo.config:\n\n```\n[target.armv7-unknown-linux-musleabihf]\nlinker = \"arm-buildroot-linux-musleabihf-gcc\"\n```\n\n2. Dockerfile:\n\n```\nFROM rust:1.36.0\n\nENV TARGET=\"armv7-unknown-linux-musleabihf\"\n\nARG TOOLCHAIN_ARM7=\"armv7-eabihf--musl--stable-2018.02-2\"\nARG TC_ARM7_URL=\"https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/${TOOLCHAIN_ARM7}.tar.bz2\"\n\nRUN rustup target add ${TARGET}\nCOPY cargo.config \"${CARGO_HOME}/config\"\n\nWORKDIR /opt\nRUN curl -o- ${TC_ARM7_URL} | tar -xjf -\n\nENV PATH=\"${PATH}:/opt/${TOOLCHAIN_ARM7}/bin\"\nENV CC_armv7_unknown_linux_musleabihf=arm-buildroot-linux-musleabihf-gcc\nENV CXX_armv7_unknown_linux_musleabihf=arm-buildroot-linux-musleabihf-g++\nENV LD_armv7_unknown_linux_musleabihf=arm-buildroot-linux-musleabihf-ld\n\nWORKDIR /work\nRUN git clone https://github.com/sodiumoxide/sodiumoxide\n\nWORKDIR /work/sodiumoxide\nRUN cargo build --target=${TARGET}\n```\n\n### Cross-Compiling for 32-bit Linux\n\n1. Install dependencies and toolchain:\n\n```\nsudo apt update\nsudo apt install build-essential gcc-multilib -y\nrustup target add i686-unknown-linux-gnu\n```\n\n2. Build by running:\n\n```\ncargo build --release --target i686-unknown-linux-gnu\n```\n\n## Examples\n\nTBD\n\n## Platform Compatibiility\n\nSodiumoxide has been tested on:\n\n- Linux: Yes\n- Windows: Yes (MSVC)\n- Mac OS: Yes\n- IOS: TODO\n- Android: Yes\n\n\n# Join in\n\nFile bugs in the issue tracker\n\nMaster git repository\n\n    git clone https://github.com/sodiumoxide/sodiumoxide.git\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nGo through the [CONTRIBUTING.md](https://github.com/sodiumoxide/sodiumoxide/blob/master/CONTRIBUTING.md) document to know more about how to contribute to this project.\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n\n### Code of Conduct\n\nWe believe in creating an enabling community for developers and have laid out a general [code of conduct](https://github.com/sodiumoxide/sodiumoxide/blob/master/CODE_OF_CONDUCT.md). Please read and adopt it to help us achieve and maintain the desired community standards.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsodiumoxide%2Fsodiumoxide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsodiumoxide%2Fsodiumoxide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsodiumoxide%2Fsodiumoxide/lists"}