Expand description
Scram-RS (Sync and Async)
Provides a SASL SCRAM:
- SHA1
- SHA256
- SHA512
- -PLUS
Features:
-
default: “std”, “use_ring”
-
use_ring- adds crate: ring as an alternative hashing and other crypto functions. -
exclude_sha1- if enabled excludes the SHA1. -
std- when set uses std lib, if removed, a no_std + alloc A program which includes this crate is based on standart library i.e std. For non-std an alloc crate is exported. Enabled by default. If CAPI was NOT excluded, and std was excluded, the crate will not be able to allocate memory in heap. For this reason, the set_allocator() should be called before using this crate in C program. -
with_async- insludes async code -
with_capi- includes CAPI code. -
xor_without_u128- do not use the u128 type while performing XOR of arrays
For default crypto crates: scram-rs = { version = “0.13”, default-features = true}
For ring crypto crates:
scram-rs = { version = “0.13”, default-features = false, features = [“use_ring”]}
§scram_sha256_server() sync tests (DEBUG) on AMD Ryzen 5 7600X 6-Core Processor 5453 MHz
| iteration | rust-native | use_ring |
|---|---|---|
| 1 | 30.481112ms | 7.813466ms |
§scram_sha256_works() async tests (DEBUG)
| iteration | rust-native | use_ring |
|---|---|---|
| 1 | 30.935835ms | 7.913466ms |
For usage see ./examples/ For C usage see ./tests/
Files:
- scram.rs contains client/server sync and async protocol handler
- scram_sync.rs a synchronious realization of the protocol handler
- scram_async.rs an asynchronious realization of the protocol handler
- scram_parser.rs a scram message parser
- scram_state.rs a global state of the protocol handler
- scram_hashing.rs contains all supported hashers implementation
- scram_error.rs error reporting code
- scram_common.rs a common code
- scram_cb.rs a channel bind code
- scram_auth.rs a authentification callbacks and interface
Re-exports§
pub use scram_cb::ChannelBindType;pub use scram_common::ScramTypes;pub use scram_hashing_sha1::ScramSha1Ring;pub use scram_hashing_sha1::ScramSha1RustNative;pub use scram_hashing_sha2::ScramSha256Ring;pub use scram_hashing_sha2::ScramSha256RustNative;pub use scram_hashing_sha3_5::ScramSha3_512RustNative;pub use scram_hashing_sha5::ScramSha512Ring;pub use scram_hashing_sha5::ScramSha512RustNative;pub use scram::*;pub use scram_auth::*;pub use scram_common::*;pub use scram_hashing::*;pub use scram_error::*;pub use scram_cbh::*;pub use scram_dyn::*;
Modules§
- scram
- A common items for the whole crate which is related to SCRAM.
- scram_
async - Async code client/server.
- scram_
auth - A helpers for auth.
- scram_
cb - A common code for channel binding protocol.
- scram_
cbh - Channel binding helper for sync code.
- scram_
common - A common code which is not related to SCRAM.
- scram_
dyn - A dynamic instancing for sync client/server.
- scram_
error - Crate’s error alias.
- scram_
hashing - A hashing algorithms.
- scram_
hashing_ sha1 - SHA1
- scram_
hashing_ sha2 - SHA256
- scram_
hashing_ sha5 - SHA512
- scram_
hashing_ sha3_ 5 - SHA3-512
- scram_
sync - Sync code client/server.
- scram_
sync_ client - Sync client.
- scram_
sync_ server - Sync server.
Macros§
- HELPER_
ERROR_ CLIENT - Use this macro in functions of trais ScramCbHelper, crate::scram_async::AsyncScramCbHelper on client side in order to indicate that the data is not possible to retrive
- HELPER_
ERROR_ SERVER - Use this macro in functions of trais ScramCbHelper, crate::scram_async::AsyncScramCbHelper on server side in order to indicate that the data is not possible to retrive
- HELPER_
UNSUP_ CLIENT - Use this macro in functions of trais ScramCbHelper, crate::scram_async::AsyncScramCbHelper on client side in order to indicate that this type of channel bind is not supported!
- HELPER_
UNSUP_ SERVER - Use this macro in functions of trais ScramCbHelper, crate::scram_async::AsyncScramCbHelper on server side in order to indicate that this type of channel bind is not supported!
- scram_
error - scram_
error_ map - scram_
ierror - scram_
ierror_ map