Struct ScramCommon

Source
pub struct ScramCommon {}

Implementations§

Source§

impl ScramCommon

Source

pub const SCRAM_RAW_NONCE_LEN: usize = 32usize

A default raw (non base64) nonce length

Source

pub const MOCK_AUTH_NONCE_LEN: usize = 16usize

A mock salt default len

Source

pub const SCRAM_DEFAULT_SALT_ITER: NonZeroU32

Default HMAC iterations

Source

pub const SCRAM_MAX_ITERS: u32 = 999_999_999u32

Source

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
Source

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:

Source

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.