| Crates.io | dcrypt-internal |
| lib.rs | dcrypt-internal |
| version | 1.2.2 |
| created_at | 2025-07-24 20:33:37.299052+00 |
| updated_at | 2025-12-10 20:20:49.310553+00 |
| description | Internal utilities for the dcrypt library |
| homepage | |
| repository | https://github.com/ioi-foundation/dcrypt |
| max_upload_size | |
| id | 1766895 |
| size | 17,719 |
internal)The internal crate provides low-level utility functions and modules that are shared across various dcrypt crates but are not intended to be part of the public API. These utilities typically deal with implementation details crucial for security or correctness, such as constant-time operations or byte-order conversions.
Constant-Time Operations (constant_time.rs):
ct_eq(a: AsRef<[u8]>, b: AsRef<[u8]>) -> bool: Constant-time equality comparison for byte slices, leveraging the subtle crate.ct_select<T: ConditionallySelectable>(a: T, b: T, condition: bool) -> T: Constant-time conditional selection.ct_assign(dst: &mut [u8], src: &[u8], condition: bool): Constant-time conditional assignment for byte slices.ct_eq_choice(a, b) -> subtle::Choice: Constant-time equality returning a subtle::Choice.ct_and, ct_or, ct_xor: Constant-time bitwise operations on fixed-size byte arrays.ct_op: Generic constant-time conditional operation on byte arrays.ct_mask(condition: bool) -> u8: Generates an all-1s or all-0s mask based on a condition.subtle crate for its underlying constant-time primitives.Endianness Utilities (endian.rs):
u32 and u64 types.u32_from_le_bytes, u32_from_be_bytesu32_to_le_bytes, u32_to_be_bytesu64_from_le_bytes, u64_from_be_bytesu64_to_le_bytes, u64_to_be_bytesbyteorder crate functionalities but provide a centralized internal API.Secure Memory Zeroing (zeroing.rs):
secure_zero(data: &mut [u8]): Uses data.zeroize() from the zeroize crate.secure_clone_and_zero(data: &mut [u8]) -> Vec<u8>: Clones a slice and then zeroes the original.ZeroGuard<'a> Struct: An RAII guard that ensures a mutable byte slice is zeroed when the guard goes out of scope.SIMD Utilities (simd module in lib.rs) (conditional on simd feature):
is_available() -> bool: Checks for sse2 target feature as an example.The internal crate is strictly for use by other dcrypt crates (e.g., algorithms, common). Its contents are considered implementation details and are subject to change without notice, as they are not governed by the public API stability promises of the dcrypt library.
By centralizing these low-level, security-critical utilities, dcrypt aims to: