Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trait for tweakable block ciphers #177

Open
newpavlov opened this issue Jun 8, 2020 · 0 comments
Open

Trait for tweakable block ciphers #177

newpavlov opened this issue Jun 8, 2020 · 0 comments
Labels
cipher Block and stream cipher crate

Comments

@newpavlov
Copy link
Member

Threefish is an example of tweakable block cipher, thus ideally we need an appropriate trait for it.

One option is to use something like this:

pub trait TweakableBlockCipher {
    type BlockSize: ArrayLength<u8>;
    type TweakSize: ArrayLength<u8>;

    fn encrypt(&self, b: &mut Block<Self::BlockSize>,  t: &Block<Self::TweakSize>);

    fn decrypt(&self, b: &mut Block<Self::BlockSize>, t: &Block<Self::TweakSize>);
}

Additional context can be found in the previous issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cipher Block and stream cipher crate
Projects
None yet
Development

No branches or pull requests

2 participants