Skip to content

Commit

Permalink
feat(crypto::block): Move encryption traits
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth committed Sep 29, 2015
1 parent 934cd42 commit 43af74f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/crypto/block/blowfish.rs
Expand Up @@ -6,7 +6,7 @@ use byteorder::{
BigEndian
};

use crypto::traits::*;
use super::{BlockEncrypt, BlockDecrypt};

fn next_u32<'a, T: Iterator<Item=&'a u8>>(iter: &mut T) -> u32 {
(0..4).fold(0, |v, _| { (v << 8) | *iter.next().unwrap() as u32 })
Expand Down Expand Up @@ -369,7 +369,7 @@ pub fn bcrypt<I: AsRef<[u8]>, O: AsMut<[u8]>>(cost: usize, salt: I, input: I, mu
#[cfg(test)]
mod test {
use super::*;
use crypto::traits::*;
use crypto::block::{BlockEncrypt, BlockDecrypt};

struct Test {
key: [u8; 8],
Expand Down
16 changes: 16 additions & 0 deletions src/crypto/block/mod.rs
@@ -1 +1,17 @@
#[cfg(feature = "blowfish")] pub mod blowfish;

pub trait BlockEncrypt<T> {
fn block_size() -> usize;

fn encrypt_block<I, O>(&self, input: I, output: O)
where I: AsRef<[T]>,
O: AsMut<[T]>;
}

pub trait BlockDecrypt<T> {
fn block_size() -> usize;

fn decrypt_block<I, O>(&self, input: I, output: O)
where I: AsRef<[T]>,
O: AsMut<[T]>;
}
1 change: 0 additions & 1 deletion src/crypto/mod.rs
@@ -1,4 +1,3 @@
pub mod block;
pub mod stream;
pub mod public_key;
pub mod traits;
15 changes: 0 additions & 15 deletions src/crypto/traits.rs

This file was deleted.

0 comments on commit 43af74f

Please sign in to comment.