Skip to content

implementation of md6 in pure rust #636

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
42 changes: 14 additions & 28 deletions md6/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,28 @@ pub const MD6_MAX_R: usize = 255;
/// Large so that MD6 is fully hierarchical
pub const MD6_DEFAULT_L: usize = 64;

/// Number of bits in a word
pub const MD6_W: usize = 64;
/// Size of compression output in words
pub const MD6_C: usize = 16;
/// Size of compression input block in words
pub const MD6_N: usize = 89;

// These five values give lengths of the components of compression
// input block; they should sum to MD6_N.
/// Q words in a compression block (>= 0)
pub const MD6_Q: usize = 15;
/// Key words per compression block (>= 0)
pub const MD6_K: usize = 8;
/// Words for unique node ID (0 or 64/w)
pub const MD6_U: usize = 64 / MD6_W;
/// Words for control word (0 or 64/w)
pub const MD6_V: usize = 64 / MD6_W;
/// Data words per compression block (> 0)
pub const MD6_B: usize = 64;

/// Number of bits in a word (64)
pub const W: usize = MD6_W;
pub const W: usize = 64;
/// Size of compression output in words (16)
pub const C: usize = MD6_C;
pub const C: usize = 16;
/// Size of compression input block in words (89)
pub const N: usize = MD6_N;
pub const N: usize = 89;
/// Q words in a compression block (>= 0) (15)
pub const Q: usize = MD6_Q;
pub const Q: usize = 15;
/// Key words per compression block (>= 0) (8)
pub const K: usize = MD6_K;
pub const K: usize = 8;
/// Words for unique node ID (0 or 64/w)
pub const U: usize = MD6_U;
pub const U: usize = 1;
/// Words for control word (0 or 64/w)
pub const V: usize = MD6_V;
pub const V: usize = 1;
/// Data words per compression block (> 0) (64)
pub const B: usize = MD6_B;
pub const B: usize = 64;

const _: () = {
if Q + K + U + V + B != N {
panic!("`Q + K + U + V` must be equal to `N`");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot B, it should be "Q + K + U + V + B" in the panic message.

}
};

/// Index for linear feedback
pub const T0: usize = 17;
Expand Down
2 changes: 1 addition & 1 deletion md6/src/md6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl Md6VarCore {
p: usize,
z: usize,
) {
let mut n = [0; MD6_N];
let mut n = [0; N];
let mut a = [0; 5000];

// check that the input values are sensible
Expand Down
Loading