Rusty implementation of Tencent modified TEA (tc_tea).
Test data generated using its C++ implementation: tc_tea.cpp (BSD-3-Clause).
Code implemented according to the spec described in iweizime/StepChanger:腾讯 TEA 加密算法.
secure_random
(default: on
): Enable secure RNG when generating padding bytes for tc_tea.Add the following to [dependencies]
section in your Cargo.toml
file:
toml
tc_tea = "0.1.0"
>= 16
bytes.
None
will be returned in this case.None
will be returned in this case.```rust use tc_tea;
fn hellotctea() { let key = "12345678ABCDEFGH"; let encrypted = tctea::encrypt(&"hello", &key).unwrap(); let decrypted = tctea::decrypt(&encrypted, &key).unwrap(); asserteq!("hello", std::str::fromutf8(&decrypted).unwrap()); } ```
Dual licensed under MIT OR Apache-2.0 license.
SPDX-License-Identifier: MIT OR Apache-2.0