xtea-cipher 0.0.2

A minimal, zero-dependency XTEA block (de)cipher utility.
Documentation
  • Coverage
  • 74.19%
    23 out of 31 items documented0 out of 29 items with examples
  • Size
  • Source code size: 13.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • heavens/xtea-cipher
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • heavens

XTEA Block (De)cipher

Usage

Currently, there are only two direct means of working with this crate in its current state.

A basic, minimal example for encrypting some arbitrary data could be achieved by the following:

/// Construct the block cipher accordingly to fit the use-case.
let xtea_cipher = Xtea::using_key([0u32, 0u32, 0u32, 0u32])
    // Optionally, the amount of rounds to be applied may be specified. Otherwise, the
    // suggested amount of 32 will be used.
    .with_rounds(10);

/// Create the input array to be processed as well as a suitable output array to write the processed results to.
let mut input = vec![0u8; 60];
let mut output = Vec::with_capacity(input.len());

/// Handle any error results.
if let Err(e) = xtea_cipher.encipher(&mut input, &mut output) {
        ...    
}

Similarly, decrypting data can be achieved by doing the following:

let xtea_cipher = Xtea::using_key([0u32, 0u32, 0u32, 0u32]);

let mut input = vec![0u8; 60];
let mut output = Vec::with_capacity(input.len());

/// Handle any error results.
if let Err(e) = xtea_cipher.decipher(&mut input, &mut output) {
    ..
}

Note

This crate is likely to undergo breaking changes over the span of future releases until its marked as stable in version 1.0.0. However, breaking changes will be avoided unless justified. Additionally, please feel free to create an issue on github citing any bugs/unexpected behavior and or lacking support.