Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions hc-256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ repository = "https://github.com/RustCrypto/stream-ciphers"
keywords = ["crypto", "stream-cipher", "trait"]
categories = ["cryptography", "no-std"]
readme = "README.md"
edition = "2018"

[dependencies]
block-cipher-trait = "0.6"
stream-cipher = "0.3"
block-cipher = "= 0.7.0-pre"
stream-cipher = "= 0.4.0-pre"
zeroize = { version = "1", optional = true }

[dev-dependencies]
stream-cipher = { version = "0.3", features = ["dev"] }
block-cipher-trait = { version = "0.6", features = ["dev"] }
stream-cipher = { version = "= 0.4.0-pre", features = ["dev"] }
block-cipher = { version = "= 0.7.0-pre", features = ["dev"] }

[badges]
maintenance = { status = "experimental" }
Expand Down
22 changes: 7 additions & 15 deletions hc-256/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
#![no_std]
extern crate block_cipher_trait;
//! HC-256 Stream Cipher

#[cfg(cargo_feature = "zeroize")]
extern crate zeroize;
#![no_std]

pub extern crate stream_cipher;
pub use stream_cipher;

use block_cipher_trait::generic_array::typenum::U32;
use block_cipher_trait::generic_array::GenericArray;
use stream_cipher::NewStreamCipher;
use stream_cipher::StreamCipher;
use block_cipher::consts::U32;
use block_cipher::generic_array::GenericArray;
use stream_cipher::{NewStreamCipher, StreamCipher};

#[cfg(cargo_feature = "zeroize")]
use std::ops::Drop;
#[cfg(cargo_feature = "zeroize")]
use zeroize::Zeroize;

const TABLE_SIZE: usize = 1024;

const TABLE_MASK: usize = TABLE_SIZE - 1;

const INIT_SIZE: usize = 2660;

const KEY_BITS: usize = 256;

const KEY_WORDS: usize = KEY_BITS / 32;

const IV_BITS: usize = 256;

const IV_WORDS: usize = IV_BITS / 32;

/// The HC-256 stream cipher
pub struct HC256 {
ptable: [u32; TABLE_SIZE],
qtable: [u32; TABLE_SIZE],
Expand Down
6 changes: 1 addition & 5 deletions hc-256/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
extern crate block_cipher_trait;
extern crate hc_256;
extern crate stream_cipher;

use block_cipher_trait::generic_array::GenericArray;
use block_cipher::generic_array::GenericArray;
use hc_256::HC256;
use stream_cipher::NewStreamCipher;
use stream_cipher::StreamCipher;
Expand Down