librash

Crates.iolibrash
lib.rslibrash
version0.1.0
created_at2025-06-09 15:41:21.149703+00
updated_at2025-06-09 15:41:21.149703+00
descriptionRust system library for cryptographic hashes
homepage
repositoryhttps://github.com/kpcyrd/librash
max_upload_size
id1706081
size39,749
(kpcyrd)

documentation

README

librash

Rust system library for cryptographic hashes.

This library provides two interfaces into the C dynamic linking ecosystem:

  • A binary interface that can be accessed through a (dynamic-)linker
  • A macro based API drop-in that redirects EVP_* function calls

Due to this design, it's possible to select this as an OpenSSL drop-in at compile-time, but the compiled binary can still co-exist with other programs that depend on an actual OpenSSL libcrypto.so to be present. You could even load both into the same process without having conflicting symbols.

Build instructions

cargo cbuild --release
## optional
#cargo ctest
cargo cinstall --release --frozen --prefix /usr --destdir /tmp/some-place

Compiling example code

# Compile the library and generate headers
cargo cinstall --release --frozen --prefix /usr --destdir pkgdir/
# Using librash function names
gcc -o mdtest contrib/example-librash.c -I pkgdir/usr/include -L pkgdir/usr/lib/ -lrash
# Using OpenSSL function names and compat header
#gcc -o mdtest contrib/example-openssl3.c -I . -I pkgdir/usr/include -L pkgdir/usr/lib/ -lrash
# Test the binary
LD_LIBRARY_PATH=pkgdir/usr/lib ./mdtest sha256

License

MIT OR Apache-2.0

Commit count: 19

cargo fmt