RustCrypto: CTS
Generic implementation of the ciphertext stealing block cipher modes of operation.
Example
use Aes128;
use ;
use hex;
type Aes128CbcCs3 = CbcCs3;
let key = ;
let iv = ;
// Message must be bigger than block size (16 bytes for AES-128)
let msg = b"Lorem ipsum dolor sit amet";
let mut buf = ;
new
.encrypt_b2b.unwrap;
assert_eq!;
new
.decrypt.unwrap;
assert_eq!;
If you wan to encrypt many messages with one key, you can use a block cipher reference to create CTS modes:
use Aes128;
use ;
use hex;
let key = ;
let cipher = new;
let iv1 = ;
let msg1 = b"Lorem ipsum dolor sit amet";
let mut buf1 = ;
let iv2 = ;
let msg2 = b"Lorem ipsum dolor sit";
let mut buf2 = ;
inner_iv_init
.encrypt_b2b.unwrap;
assert_eq!;
inner_iv_init
.encrypt_b2b.unwrap;
assert_eq!;
License
Licensed under either of:
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.