Struct xtsn::CXTSN

source ·
pub struct CXTSN { /* private fields */ }
Expand description

This structure is the C-Version of the XTSN decryptor It works the same way the XTSN version does!

Implementations

initializes a new Cryptor it requires 2 keys:

  • crypt to decrypt
  • tweak to encrypt they can be the same but shouldn’t !!!

This function is used to encrypt data. It works only with buffers, that are a multiple of 0x200! The function doesn’t check the buffer so it will silently ignore any trailing bytes in the buffer!

Example
extern crate XTSN;

fn main() {
    let mut data = b"Hello XTSN".to_vec();
    // the string is not 0x200 bytes:
    while data.len() != 0x200 {
        data.push(0);
    }
    let xts = match XTSN::CXTSN::new("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
                                    "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") {
        Ok(res) => res,
        Err(e) => panic!(e),
    };
    let ret = match xts.encrypt(data, 0) {
        Ok(res) => res,
        Err(e) => panic!(e),
    };
    println!("{:?}", &ret);
}

This function is used to decrypt data. It works only with buffers, that are a multiple of 0x200! The function doesn’t check the buffer so it will silently ignore any trailing bytes in the buffer! This function is currently broken and need some debugging, or you can just use the CXTSN version which just works :3

Example
extern crate XTSN;

fn main() {
    let mut data = b"Hello XTSN".to_vec();
    // the string is not 0x200 bytes:
    while data.len() != 0x200 {
        data.push(0);
    }
    let xts = match XTSN::CXTSN::new("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
                                     "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") {
        Ok(res) => res,
        Err(e) => panic!(e),
    };
    let ret = match xts.decrypt(data, 0) {
        Ok(res) => res,
        Err(e) => panic!(e),
    };
    println!("{:?}", &ret);
}

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.