pub struct ScramCommon {}
Implementations§
Source§impl ScramCommon
impl ScramCommon
Sourcepub const SCRAM_RAW_NONCE_LEN: usize = 32usize
pub const SCRAM_RAW_NONCE_LEN: usize = 32usize
A default raw (non base64) nonce length
Sourcepub const MOCK_AUTH_NONCE_LEN: usize = 16usize
pub const MOCK_AUTH_NONCE_LEN: usize = 16usize
A mock salt default len
Sourcepub const SCRAM_DEFAULT_SALT_ITER: NonZeroU32
pub const SCRAM_DEFAULT_SALT_ITER: NonZeroU32
Default HMAC iterations
pub const SCRAM_MAX_ITERS: u32 = 999_999_999u32
Sourcepub fn sc_random(len: usize) -> ScramResult<Vec<u8>>
pub fn sc_random(len: usize) -> ScramResult<Vec<u8>>
Generates random secuence of bytes. Slower than unsafe function.
§Arguments
len
- a length of the array
§Returns
- ScramResult Ok - elements or Error
Sourcepub unsafe fn sc_random_unsafe(len: usize) -> ScramResult<Vec<u8>>
pub unsafe fn sc_random_unsafe(len: usize) -> ScramResult<Vec<u8>>
Generates random secuence of bytes in unsafe way i.e not initializing the vec.
If capacity will be larger (if the len is not aligned) than requested, will contain garbadge at the rest indexes.
§Panic
Does not panic
§Arguments
len
- a length of the array
§Returns
A ScramResult is returned:
-
Result::Ok with the Vec if u8
-
Result::Err with error:
Sourcepub fn sc_random_ring_secure(len: usize) -> ScramResult<Vec<u8>>
pub fn sc_random_ring_secure(len: usize) -> ScramResult<Vec<u8>>
Generates random secuence of bytes using Ring crate.
Considered unsafe because of the Ring crate.
§Arguments
len
- a length of the array
§Returns
- ScramResult Ok - elements or Error
Auto Trait Implementations§
impl Freeze for ScramCommon
impl RefUnwindSafe for ScramCommon
impl Send for ScramCommon
impl Sync for ScramCommon
impl Unpin for ScramCommon
impl UnwindSafe for ScramCommon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more