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

feat: implement CAST5 based on RFC 2144 #36

Merged
merged 4 commits into from
Mar 11, 2019

Conversation

dignifiedquire
Copy link
Member

As described in https://tools.ietf.org/html/rfc2144

Test vectors are based on the RFC as well.

Benchmarks on my Macbook i9 2.7Ghz

running 2 tests
test decrypt ... bench:          46 ns/iter (+/- 6) = 173 MB/s
test encrypt ... bench:          47 ns/iter (+/- 6) = 170 MB/s

@dignifiedquire dignifiedquire mentioned this pull request Nov 8, 2018
19 tasks
@dignifiedquire
Copy link
Member Author

@newpavlov any update on this? I would really like to get this up on crates.io, but the cast5 crate is reserved by rustcrypto

@dignifiedquire
Copy link
Member Author

Ping @newpavlov I can also keep it in my own repo for now, but would really like to use the crate name, which is reserved by rustcrypto though

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

Thank you for you contribution and sorry for the long absence!

I will merge this PR and publish it after some minor changes.

cast5/Cargo.toml Outdated Show resolved Hide resolved
cast5/src/cast5.rs Outdated Show resolved Hide resolved
cast5/Cargo.toml Outdated Show resolved Hide resolved
cast5/LICENSE-MIT Outdated Show resolved Hide resolved
cast5/src/cast5.rs Outdated Show resolved Hide resolved
cast5/src/cast5.rs Outdated Show resolved Hide resolved
cast5/tests/lib.rs Outdated Show resolved Hide resolved
@dignifiedquire
Copy link
Member Author

Thanks for the review @newpavlov I have implemented all the suggestions, except for the additional test vectors

cast5/src/cast5.rs Outdated Show resolved Hide resolved
let (l, r) = if self.small_key {
(l, r)
} else {
// Rounds 13..16 are only executed for keys > 80 bits.
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I wonder if it'll be worth to introduce two structs Cast5 for 80-128 bit keys and SmallCast5 for 40-80 bit keys. Have you measured the performance impact of adding this branching?

Copy link
Member Author

Choose a reason for hiding this comment

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

There was no noticeable difference in the benchmarks I ran for 128bit keys befor and after

@dignifiedquire
Copy link
Member Author

@newpavlov should be ready

@newpavlov newpavlov merged commit 73c0117 into RustCrypto:master Mar 11, 2019
@newpavlov
Copy link
Member

Sorry again for delay! I will introduce some minor changes and will publish the crate!

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

Successfully merging this pull request may close these issues.

None yet

2 participants