Skip to content

Commit 4a65fa4

Browse files
authored
rc6: RC6 Implementation (#439)
Implementation and documentation are aligned with rc5 implementation. I referred following document for key schedule, encryption and decryption algorithms: https://www.grc.com/r&d/rc6.pdf I checked whether it works by following test vectors. https://datatracker.ietf.org/doc/html/draft-krovetz-rc6-rc5-vectors-00#section-3
1 parent bf53f63 commit 4a65fa4

File tree

13 files changed

+1139
-0
lines changed

13 files changed

+1139
-0
lines changed

.github/workflows/rc6.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: rc6
2+
on:
3+
pull_request:
4+
paths:
5+
- "rc6/**"
6+
- "Cargo.*"
7+
push:
8+
branches: master
9+
10+
defaults:
11+
run:
12+
working-directory: rc6
13+
14+
env:
15+
CARGO_INCREMENTAL: 0
16+
RUSTFLAGS: "-Dwarnings"
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
rust:
24+
- 1.65.0 # MSRVs
25+
- stable
26+
target:
27+
- thumbv7em-none-eabi
28+
- wasm32-unknown-unknown
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: RustCrypto/actions/cargo-cache@master
32+
- uses: dtolnay/rust-toolchain@master
33+
with:
34+
toolchain: ${{ matrix.rust }}
35+
targets: ${{ matrix.target }}
36+
- run: cargo build --no-default-features --release --target ${{ matrix.target }}
37+
38+
minimal-versions:
39+
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
40+
with:
41+
working-directory: ${{ github.workflow }}
42+
43+
test:
44+
runs-on: ubuntu-latest
45+
strategy:
46+
matrix:
47+
rust:
48+
- 1.65.0 # MSRVs
49+
- stable
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: RustCrypto/actions/cargo-cache@master
53+
- uses: dtolnay/rust-toolchain@master
54+
with:
55+
toolchain: ${{ matrix.rust }}
56+
- run: cargo check --all-features
57+
- run: cargo test --no-default-features
58+
- run: cargo test
59+
- run: cargo test --all-features

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ members = [
1515
"magma",
1616
"rc2",
1717
"rc5",
18+
"rc6",
1819
"serpent",
1920
"sm4",
2021
"speck",

rc6/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "rc6"
3+
version = "0.1.0"
4+
description = "RC6 block cipher"
5+
authors = ["RustCrypto Developers"]
6+
edition = "2021"
7+
license = "MIT OR Apache-2.0"
8+
readme = "README.md"
9+
repository = "https://github.com/RustCrypto/block-ciphers"
10+
keywords = ["crypto", "rc6", "block-cipher"]
11+
categories = ["cryptography"]
12+
13+
[dependencies]
14+
cipher = { version = "0.5.0-pre.6", features = ["zeroize"] }
15+
16+
[dev-dependencies]
17+
cipher = { version = "0.5.0-pre.6", features = ["dev"] }
18+
19+
[features]
20+
zeroize = []

rc6/LICENSE-APACHE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2017 Damian Czaja
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

rc6/LICENSE-MIT

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (c) 2017 Damian Czaja
2+
3+
Permission is hereby granted, free of charge, to any
4+
person obtaining a copy of this software and associated
5+
documentation files (the "Software"), to deal in the
6+
Software without restriction, including without
7+
limitation the rights to use, copy, modify, merge,
8+
publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software
10+
is furnished to do so, subject to the following
11+
conditions:
12+
13+
The above copyright notice and this permission notice
14+
shall be included in all copies or substantial portions
15+
of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25+
DEALINGS IN THE SOFTWARE.

rc6/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# [RustCrypto]: RC6 Cipher
2+
3+
[![crate][crate-image]][crate-link]
4+
[![Docs][docs-image]][docs-link]
5+
[![Build Status][build-image]][build-link]
6+
![Apache2/MIT licensed][license-image]
7+
![Rust Version][rustc-image]
8+
[![Project Chat][chat-image]][chat-link]
9+
[![HAZMAT][hazmat-image]][hazmat-link]
10+
11+
Pure Rust implementation of the [RC6] block cipher.
12+
13+
[Documentation][docs-link]
14+
15+
## ⚠️ Security Warning: [Hazmat!][hazmat-link]
16+
17+
This crate does not ensure ciphertexts are authentic (i.e. by using a MAC to
18+
verify ciphertext integrity), which can lead to serious vulnerabilities
19+
if used incorrectly!
20+
21+
No security audits of this crate have ever been performed, and it has not been
22+
thoroughly assessed to ensure its operation is constant-time on common CPU
23+
architectures.
24+
25+
USE AT YOUR OWN RISK!
26+
27+
## Minimum Supported Rust Version
28+
29+
Rust **1.56** or higher.
30+
31+
Minimum supported Rust version can be changed in the future, but it will be
32+
done with a minor version bump.
33+
34+
## SemVer Policy
35+
36+
- All on-by-default features of this library are covered by SemVer
37+
- MSRV is considered exempt from SemVer as noted above
38+
39+
## License
40+
41+
Licensed under either of:
42+
43+
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
44+
* [MIT license](http://opensource.org/licenses/MIT)
45+
46+
at your option.
47+
48+
### Contribution
49+
50+
Unless you explicitly state otherwise, any contribution intentionally submitted
51+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
52+
dual licensed as above, without any additional terms or conditions.
53+
54+
[//]: # (badges)
55+
56+
[crate-image]: https://img.shields.io/crates/v/rc6.svg
57+
[crate-link]: https://crates.io/crates/rc6
58+
[docs-image]: https://docs.rs/rc6/badge.svg
59+
[docs-link]: https://docs.rs/rc6/
60+
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
61+
[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg
62+
[hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg
63+
[hazmat-link]: https://github.com/RustCrypto/meta/blob/master/HAZMAT.md
64+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
65+
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260039-block-ciphers
66+
[build-image]: https://github.com/RustCrypto/block-ciphers/actions/workflows/rc6.yml/badge.svg
67+
[build-link]: https://github.com/RustCrypto/block-ciphers/actions/workflows/rc6.yml
68+
69+
[//]: # (general links)
70+
71+
[RustCrypto]: https://github.com/RustCrypto/
72+
[RC6]: https://en.wikipedia.org/wiki/RC6

0 commit comments

Comments
 (0)