4 releases

0.0.3 Oct 22, 2023
0.0.2 Oct 14, 2023
0.0.1 Oct 14, 2023
0.0.0 Oct 13, 2023

#1085 in Cryptography

CC0 license

2.5MB
69K SLoC

GNU Style Assembly 48K SLoC // 0.0% comments C 19K SLoC // 0.1% comments Bitbake 1K SLoC // 0.3% comments XSL 758 SLoC // 0.1% comments Rust 495 SLoC // 0.0% comments

xkcp-rs

Bindings and wrappers to the eXtended Keccak Code Package (XKCP) library.

Documentation

[!IMPORTANT] The xkcp-rs API will never be considered stable, and is subject to change at any time without prior warning.

Requirements

To build on Linux or macOS, the following tools are needed:

Windows is not supported at the moment.

CC flags are selected using cc-rs. Refer to their documentation on how to configure cc-rs externally.

XKCP targets

XKCP targets are automatically selected through CARGO_* environment variables. This behavior can be overridden by using feature flags (see below) or by directly specifying the XKCP target with the XKCP_RS_TARGET environment variable.

Refer to the XKCP documentation for more details.

Usage

Cargo.toml:

[dependencies]
xkcp-rs = "0.0.2"

src/main.rs:

fn main() {
    let mut output = [0u8; 32];
    xkcp_rs::sha3_256(b"Hello, World!", &mut output);
    println!("{output:x?}");
}

Feature flags

xkcp-rs only:

  • std: Enable std-only features, like implementations of std::error::Error. Enabled by default.

xkcp-rs and xkcp-sys:

  • avr8: Forces building for the AVR8 (8-bit AVR) XKCP target.
  • force-compact: Forces building for the compact XKCP target. WARNING: this is generally much slower than anything else.
  • force-generic: Forces building for the generic32 or generic64 XKCP target. Falls back to compact if not building for a 32 or 64 bit architecture.
  • generic-lc: Uses the generic{32,64}lc XKCP targets instead of generic{32,64}.

Supported Rust Versions

xkcp-rs will keep a rolling MSRV (minimum supported rust version) policy of at least 6 months. When increasing the MSRV, the new Rust version must have been released at least six months ago. The current MSRV is 1.65.0.

Note that the MSRV is not increased automatically, and only as part of a minor release.

License

xkcp-rs redistributes the XKCP library, libXKCP, which is mostly released to the public domain and associated to the CC0 deed, but there are exceptions. Please refer to the LICENSE file for more information.

Dependencies

~0–2MB
~40K SLoC