Struct Des

Source
pub struct Des;
Expand description

Generator for DES-based tripcodes (4chan and 2channel’s 10-character tripcode) that accepts custom salt characters.

It is essentially the same as crypt(3), but treats invalid salt characters in 4chan and 2channel’s fashion. Invalid salt characters are reinterpreted as per the following table.

0x0123456789ABCDEF
00................
10................
20.............../
300123456789ABCDEF
40GABCDEFGHIJKLMNO
50PQRSTUVWXYZabcde
60fabcdefghijklmno
70pqrstuvwxyz.....
80................
90................
A0................
B0................
C0................
D0................
E0................
F0................

§Reference

  • https://osdn.jp/projects/naniya/wiki/2chtrip (Japanese)

Implementations§

Source§

impl Des

Source

pub fn hash<P: AsRef<[u8]>>(password: P, salt1: u8, salt2: u8) -> FourchanHash

Generates a hash value from password and a pair of custom salt characters.

Source

pub fn generate<P: AsRef<[u8]>>(password: P, salt1: u8, salt2: u8) -> String

Generates a tripcode from password and a pair of custom salt characters.

Source

pub fn append<P: AsRef<[u8]>>( password: P, salt1: u8, salt2: u8, dst: &mut String, )

Generates a tripcode and appends it to a String.

Source

pub fn write<P, W>(password: P, salt1: u8, salt2: u8, dst: &mut W) -> Result<()>
where P: AsRef<[u8]>, W: Write,

Generates a tripcode into a Write.

Auto Trait Implementations§

§

impl Freeze for Des

§

impl RefUnwindSafe for Des

§

impl Send for Des

§

impl Sync for Des

§

impl Unpin for Des

§

impl UnwindSafe for Des

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, 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.