// Copyright 2025, 2026 PARK Youngho.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(missing_docs)]
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_variables)]
// #![warn(rustdoc::missing_doc_code_examples)]
use std::vec::Vec;
use crate::number::SmallUInt;
/// trait_ecb_with_padding_iso.rs may be too big
/// because of documentation and plenty of examples.
/// So, in order to provide documentation without `docs.rs`'s failing
/// generating documentation, dummy codes were made and documentation and
/// examples were moved to des_ecb_iso.rs. And, most of generic parameters
/// are omitted. It is not actual code but dummy code for compilation!!!
#[allow(non_camel_case_types)]
pub struct DES_Generic
{
// Dummy struct for documentation
}
/// trait_ecb_with_padding_iso.rs may be too big
/// because of documentation and plenty of examples.
/// So, in order to provide documentation without `docs.rs`'s failing
/// generating documentation, dummy codes were made and documentation and
/// examples were moved to des_ecb_iso.rs. And, most of generic parameters
/// are omitted. It is not actual code but dummy code for compilation!!!
impl DES_Generic
{
// fn encrypt(&mut self, message: *const u8, length_in_bytes: u64, cipher: *mut u8) -> u64;
/// Encrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `message` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the plaintext `message` in bytes.
/// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption,
/// this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as `encrypt_*_into_*()`.
/// - This method is useful to use in hybrid programming with C/C++.
/// - If `length_in_bytes` is `0`, it means the message is null string.
/// So, only padding bytes will be encrypted,
/// and stored in the memory area that starts from `cipher`.
/// - The size of the memory area which starts at `cipher` is assumed to be
/// enough to store the ciphertext.
/// - The size of the area for ciphertext should be prepared to be
/// (`length_in_bytes` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt(message.as_ptr(), message.len() as u64, cipher1.as_mut_ptr());
/// d_des.encrypt(message.as_ptr(), message.len() as u64, cipher2.as_mut_ptr());
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for NNormal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt(message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt(&mut self, message: *const u8, length_in_bytes: u64, cipher: *mut u8) -> u64
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_into_vec<U>(&mut self, message: *const u8, length_in_bytes: u64, cipher: &mut Vec<U>) -> u64
/// Encrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode, and stores the encrypted data
/// in `Vec<U>`.
///
/// # Arguments
/// - `message` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the plaintext `message` in bytes.
/// - `cipher` is a mutable reference to `Vec<U>` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption,
/// this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_*_into_vec().
/// - This method is useful to use in hybrid programming with C/C++.
/// - If `length_in_bytes` is `0`, it means the message is a null string.
/// So, only padding bytes will be encrypted,
/// and stored in the `Vec<U>` object which is referred to as `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_into_vec(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_into_vec<U>(&mut self, message: *const u8, length_in_bytes: u64, cipher: &mut Vec<U>) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_into_array<U, const N: usize>(&mut self, message: *const u8, length_in_bytes: u64, cipher: &mut [U; N]) -> u64
/// Encrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode, and stores the encrypted data
/// in array `[U; N]`.
///
/// # Arguments
/// - `message` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the plaintext `message` in bytes.
/// - `cipher` is a mutable reference to an array `[U; N]` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_*_into_array().
/// - This method is useful to use in hybrid programming with C/C++.
/// - If `length_in_bytes` is `0`, it means the message is null data.
/// So, only padding bytes will be encrypted,
/// and stored in the array `[U; N]` object `cipher`.
/// - If `U::size_in_bytes()` * `N` is less than `length_in_bytes`'s next
/// multiple of `8`, this method does not perform
/// encryption but returns `zero`.
/// - If `U::size_in_bytes()` * `N` is equal to `length_in_bytes`'s next
/// multiple of `8`, this method performs encryption,
/// fills the array `cipher` with the encrypted data, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - If `U::size_in_bytes()` * `N` is greater than `length_in_bytes`'s next
/// multiple of `8`, this method performs encryption, fills
/// the array `cipher` with the encrypted data, and then fills the
/// rest of the elements of the array `cipher` with zeros, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - The size of the area for ciphertext should be prepared to be
/// (`length_in_bytes` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_into_array<U, const N: usize>(&mut self, message: *const u8, length_in_bytes: u64, cipher: &mut [U; N]) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_str(&mut self, message: &str, cipher: *mut u8) -> u64
/// Encrypts the data in a `str` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `message` is an immutable reference to `str` object which is `&str`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_str_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - If `message` is a null string "", only padding bytes will be encrypted,
/// and stored in the memory area that starts from `cipher`.
/// - The size of the memory area which starts at `cipher` is assumed to be
/// enough to store the ciphertext.
/// - The size of the area for ciphertext should be prepared to be
/// (`message.len()` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_str(&message, cipher1.as_mut_ptr());
/// d_des.encrypt_str(&message, cipher2.as_mut_ptr());
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 7 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_str(&mut self, message: &str, cipher: *mut u8) -> u64
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_str_into_vec<U>(&mut self, message: &str, cipher: &mut Vec<U>) -> u64
/// Encrypts the data in `str` with the padding defined according to
/// ISO 7816-4 in ECB (Electronic CodeBook) mode, and stores the
/// encrypted data in `Vec<U>`.
///
/// # Arguments
/// - `message` is an immutable reference to `str` object which is `&str`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to `Vec<U>` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is a null string "", only padding bytes will be encrypted,
/// and stored in the `Vec<U>` object which is referred to as `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_str_into_vec<U>(&mut self, message: &str, cipher: &mut Vec<U>) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_str_into_array<U, const N: usize>(&mut self, message: &str, cipher: &mut [U; N]) -> u64
/// Encrypts the data in a `str` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the encrypted data in array `[U; N]`.
///
/// # Arguments
/// - `message` is an immutable reference to `str` object which is `&str`,
/// and is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to an array `[U; N]` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is a null string "", only padding bytes will be encrypted,
/// and stored in the array `[U; N]` object `cipher`.
/// - If `U::size_in_bytes()` * `N` is less than `message.len()`'s next
/// multiple of `8`, this method does not perform
/// encryption but returns `zero`.
/// - If `U::size_in_bytes()` * `N` is equal to `message.len()`'s next
/// multiple of `8`, this method performs encryption,
/// fills the array `cipher` with the encrypted data, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - If `U::size_in_bytes()` * `N` is greater than `message.len()`'s next
/// multiple of `8`, this method performs encryption, fills
/// the array `cipher` with the encrypted data, and then fills the
/// rest of the elements of the array `cipher` with zeros, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - The size of the area for ciphertext should be prepared to be
/// (`message.len()` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_str_into_array(&message, &mut cipher1);
/// d_des.encrypt_str_into_array(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_str_into_array<U, const N: usize>(&mut self, message: &str, cipher: &mut [U; N]) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_string(&mut self, message: &String, cipher: *mut u8) -> u64
/// Encrypts the data stored in a `String` object with the padding
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `message` is an immutable reference to `String` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_string_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - If `message` is a `String` object that has a null string "", only
/// padding bytes will be encrypted, and stored in the memory area that
/// starts from `cipher`.
/// - The size of the memory area which starts at `cipher` is assumed to be
/// enough to store the ciphertext.
/// - The size of the area for ciphertext should be prepared to be
/// (`message.len()` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_string(&message, cipher1.as_mut_ptr());
/// d_des.encrypt_string(&message, cipher2.as_mut_ptr());
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// // Normal case for the message of 0 bytes
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_string(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_string(&mut self, message: &String, cipher: *mut u8) -> u64
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_string_into_vec<U>(&mut self, message: &String, cipher: &mut Vec<U>) -> u64
/// Encrypts the data stored in a `String` object with the padding
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the encrypted data in `Vec<U>`.
///
/// # Arguments
/// - `message` is an immutable reference to `String` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to `Vec<U>` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is a `String` object that has a null string "", only
/// padding bytes will be encrypted, and stored in the `Vec<U>` object
/// which is referred to as `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_string_into_vec(&message, &mut cipher1);
/// d_des.encrypt_string_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_string_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_string_into_vec<U>(&mut self, message: &String, cipher: &mut Vec<U>) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_string_into_array<U, const N: usize>(&mut self, message: &String, cipher: &mut [U; N]) -> u64
/// Encrypts the data stored in a `String` object with the padding
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the encrypted data in array `[U; N]`.
///
/// # Arguments
/// - `message` is an immutable reference to `String` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to an array `[U; N]` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is a `String` object that has a null string "", only
/// padding bytes will be encrypted, and stored in the array `[U; N]`
/// object `cipher`.
/// - If `size_of::<U>()` * `N` is less than `message.len()`'s next
/// multiple of `8`, this method does not perform
/// encryption but returns `zero`.
/// - If `size_of::<U>()` * `N` is equal to `message.len()`'s next
/// multiple of `8`, this method performs encryption,
/// fills the array `cipher` with the encrypted data, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - If `size_of::<U>()` * `N` is greater than `message.len()`'s next
/// multiple of `8`, this method performs encryption, fills
/// the array `cipher` with the encrypted data, and then fills the
/// rest of the elements of the array `cipher` with zeros, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - The size of the area for ciphertext should be prepared to be
/// (`message.len()` + `1`).next_multiple_of(`8`) at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// println!();
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_string_into_array(&message, &mut cipher1);
/// d_des.encrypt_string_into_array(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.".to_string();
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_string_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_string_into_array<U, const N: usize>(&mut self, message: &String, cipher: &mut [U; N]) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_vec<U>(&mut self, message: &Vec<U>, cipher: *mut u8) -> u64
/// Encrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `message` is an immutable reference to `Vec<U>` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_vec_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - The size of the memory area which starts at `cipher` is assumed to be
/// enough to store the ciphertext.
/// - The size of the area for ciphertext should be prepared to be
/// (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`8`)
/// at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
/// padding bytes will be encrypted, and stored in the memory area that
/// starts from `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_vec(&message, cipher1.as_mut_ptr());
/// d_des.encrypt_vec(&message, cipher2.as_mut_ptr());
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_vec(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_vec<U>(&mut self, message: &Vec<U>, cipher: *mut u8) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_vec_into_vec<U, V>(&mut self, message: &Vec<U>, cipher: &mut Vec<V>) -> u64
/// Encrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and
/// stores the encrypted data in `Vec<V>`.
///
/// # Arguments
/// - `message` is an immutable reference to `Vec<U>` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to `Vec<U>` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
/// padding bytes will be encrypted, and stored in the `Vec<U>` object
/// which is referred to as `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
///
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_vec_into_vec(&message, &mut cipher1);
/// d_des.encrypt_vec_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_vec_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_vec_into_vec<U, V>(&mut self, message: &Vec<U>, cipher: &mut Vec<V>) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_vec_into_array<U, V, const N: usize>(&mut self, message: &Vec<U>, cipher: &mut [V; N]) -> u64
/// Encrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and
/// stores the encrypted data in array `[V; N]`.
///
/// # Arguments
/// - `message` is an immutable reference to `Vec<U>` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to an array `[U; N]` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
/// padding bytes will be encrypted, and stored in the array `[U; N]`
/// object `cipher`.
/// - If `size_of::<V>()` * `N` is less than
/// `size_of::<U>() * message.len()`'s next multiple of
/// `8`, this method does not perform
/// encryption but returns `zero`.
/// - If `size_of::<V>()` * `N` is equal to
/// `size_of::<U>() * message.len()`'s next multiple of
/// `8`, this method performs encryption,
/// fills the array `cipher` with the encrypted data, and returns
/// the size of the ciphertext including padding bits in bytes.
/// - If `size_of::<V>()` * `N` is greater than
/// `size_of::<U>() * message.len()`'s next multiple of `8`,
/// this method performs encryption, fills the array `cipher` with the
/// encrypted data, and then fills the rest of the elements of the array
/// `cipher` with zeros, and returns the size of the ciphertext including
/// padding bits in bytes.
/// - The size of the area for ciphertext should be prepared to be
/// (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`8`)
/// at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_vec_into_array(&message, &mut cipher1);
/// d_des.encrypt_vec_into_array(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let message = unsafe { message.to_string().as_mut_vec().clone() };
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_vec_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_vec_into_array<U, V,const N: usize>(&mut self, message: &Vec<U>, cipher: &mut [V; N]) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_array<U, const N: usize>(&mut self, message: &[U; N], cipher: *mut u8) -> u64
/// Encrypts the data stored in an array `[U; N]` object with the padding
/// defined according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `message` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as encrypt_vec_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - The size of the memory area which starts at `cipher` is assumed to be
/// enough to store the ciphertext.
/// - The size of the area for ciphertext should be prepared to be
/// (`size_of::<U>()` * `N` + `1`).next_multiple_of(`8`)
/// at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - If `message` is an empty array `[U; 0]` object, only padding bytes
/// will be encrypted, and stored in the memory area that starts from `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_array(&message, cipher1.as_mut_ptr());
/// d_des.encrypt_array(&message, cipher2.as_mut_ptr());
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 0];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "7 bytes";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 7];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "I am OK.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 8];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "PARK Youngho";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 12];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "고맙습니다.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 16];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_array(&message, cipher.as_mut_ptr());
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_array<U, const N: usize>(&mut self, message: &[U; N], cipher: *mut u8) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_array_into_vec<U, V, const N: usize>(&mut self, message: &[U; N], cipher: &mut Vec<V>) -> u64
/// Encrypts the data stored in an array `[U; N]` object with the padding
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and stores the
/// encrypted data in `Vec<V>`.
///
/// # Arguments
/// - `message` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to `Vec<U>` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is an empty array `[U; 0]` object, only padding bytes
/// will be encrypted, and stored in the `Vec<U>` object `cipher`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
///
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_array_into_vec(&message, &mut cipher1);
/// d_des.encrypt_array_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 0];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "7 bytes";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 7];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "I am OK.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 8];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "PARK Youngho";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 12];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "고맙습니다.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 16];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_array_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_array_into_vec<U, V, const N: usize>(&mut self, message: &[U; N], cipher: &mut Vec<V>) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn encrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, message: &[U; N], cipher: &mut [V; M]) -> u64
/// Encrypts the data stored in an array `[U; N]` object with the padding
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and stores the
/// encrypted data in array `[V; M]`.
///
/// # Arguments
/// - `message` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be encrypted is stored.
/// - `cipher` is a mutable reference to an array `[U; N]` object, and
/// is the place where the encrypted data will be stored.
///
/// # Output
/// - This method returns the size of ciphertext including padding bits
/// in bytes.
/// - The output will be at least `8`,
/// and cannot be other than a multiple of `8`.
/// - If this method failed in encryption, this method returns `zero`.
///
/// # Features
/// - If `message` is an empty array `[U; 0]` object, only padding bytes
/// will be encrypted, and stored in the array `[V; M]` object `cipher`.
/// - If `V::size_in_bytes()` * `M` is less than
/// `U::size_in_bytes()` * `N`'s next multiple of `8`,
/// this method does not perform encryption and returns `zero`.
/// - If `V::size_in_bytes()` * `M` is equal to
/// `U::size_in_bytes()` * `N`'s next multiple of `8`,
/// this method performs encryption, fills the array `cipher` with the
/// encrypted ciphertext, and returns the size of the ciphertext including
/// padding bits in bytes.
/// - If `V::size_in_bytes()` * `M` is greater than
/// `U::size_in_bytes()` * `N`'s next multiple of `8`,
/// this method performs encryption, fills the array `cipher` with the
/// encrypted ciphertext, and then fills the rest of the elements of the
/// array `cipher` with zeros, and returns the size of the ciphertext
/// including padding bits in bytes.
/// - The size of the area for ciphertext should be prepared to be
/// (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`8`)
/// at least.
/// So, it is responsible for you to prepare the `cipher` area big enough!
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let mes = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 55];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_array_into_array(&message, &mut cipher1);
/// d_des.encrypt_array_into_array(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 0];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "7 bytes";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 7];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "I am OK.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 8];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "PARK Youngho";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 12];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let mes = "고맙습니다.";
/// println!("M =\t{}", mes);
/// let mut message = [0_u8; 16];
/// message.copy_from_slice(mes.as_bytes());
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_array_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
/// ```
pub fn encrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, message: &[U; N], cipher: &mut [V; M]) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt(&mut self, cipher: *const u8, length_in_bytes: u64, message: *mut u8) -> u64;
/// Decrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the ciphertext to be decrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the ciphertext `cipher` in bytes.
/// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `length_in_bytes` is greater than `8` (which means
/// that the original plaintext is surely not empty data) and it returns
/// `zero`, you can interpret it that this method surely failed in
/// decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as `decrypt_*_into_*()`.
/// - This method is useful to use in hybrid programming with C/C++.
/// - `length_in_bytes` cannot be other than any multiple of `8`.
/// - The size of the memory area which starts at `message` is assumed to
/// be enough to store the plaintext. So, it is responsible for you to
/// prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `length_in_bytes` - `1`.
/// - If the size of the area for plaintext is prepared more than
/// `length_in_bytes` - `1`, the rest of the area will be filled with
/// `0`s.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = vec![0; 55];
/// a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = vec![0; 55];
/// a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = vec![0; 55];
/// let mut recovered2 = vec![0; 55];
/// c_des.decrypt(cipher1.as_ptr(), cipher1.len() as u64, recovered1.as_mut_ptr());
/// d_des.decrypt(cipher2.as_ptr(), cipher2.len() as u64, recovered2.as_mut_ptr());
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// // Normal case for the message of 16 bytes
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 24];
/// let len = a_des.decrypt(cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt(&mut self, cipher: *const u8, length_in_bytes: u64, message: *mut u8) -> u64
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_into_vec<U>(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut Vec<U>) -> u64
/// Decrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode, and stores the decrypted data
/// in `Vec<U>`.
///
/// # Arguments
/// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the ciphertext to be decrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the ciphertext `cipher` in bytes.
/// - `message` is a mutable reference to `Vec<U>` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `length_in_bytes` is greater than `8` (which means
/// that the original plaintext is surely not empty data) and it returns
/// `zero`, you can interpret it that this method surely failed in
/// decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as decrypt_*_into_vec().
/// - This method is useful to use in hybrid programming with C/C++.
/// - `length_in_bytes` cannot be other than any multiple of `8`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the plaintext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = Vec::<u8>::new();
/// let mut recovered2 = Vec::<u8>::new();
/// c_des.decrypt_into_vec(cipher1.as_ptr(), cipher1.len() as u64, &mut recovered1);
/// d_des.decrypt_into_vec(cipher2.as_ptr(), cipher2.len() as u64, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_into_vec(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_into_vec<U>(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut Vec<U>) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_into_array<U, const N: usize>(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut [U; N]) -> u64
/// Decrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode, and stores the decrypted data
/// in array `[U; N]`.
///
/// # Arguments
/// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the ciphertext to be decrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the ciphertext `cipher` in bytes.
/// - `message` is a mutable reference to an array `[U; N]` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `length_in_bytes` is greater than `8` (which means
/// that the original plaintext is surely not empty data) and it returns
/// `zero`, you can interpret it that this method surely failed in
/// decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as decrypt_*_into_array().
/// - This method is useful to use in hybrid programming with C/C++.
/// - `length_in_bytes` cannot be other than any multiple of `8`.
/// - If `U::size_in_bytes()` * `N` is less than `length_in_bytes` - `1`,
/// this method does not perform decryption but returns `zero`.
/// - If `U::size_in_bytes()` * `N` is equal to or greater than
/// `length_in_bytes` - `1`, this method performs decryption, fills the
/// array `message` with the decrypted data, and then fills the rest of
/// the elements of the array `message` with zeros, and returns the size
/// of the plaintext.
/// - It is responsible for you to prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `length_in_bytes` - `1`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = [0u8; 56];
/// let mut recovered2 = [0u8; 56];
/// let len1 = c_des.decrypt_into_array(cipher1.as_ptr(), cipher1.len() as u64, &mut recovered1);
/// let len2 = d_des.decrypt_into_array(cipher2.as_ptr(), cipher2.len() as u64, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.write(&recovered1);
/// unsafe { converted2.as_mut_vec() }.write(&recovered2);
/// unsafe { converted1.as_mut_vec() }.truncate(len1 as usize);
/// unsafe { converted2.as_mut_vec() }.truncate(len2 as usize);
/// println!("B1b (0 rounds) =\t{}", converted1);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 24];
/// let len = a_des.decrypt_into_array(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_into_array<U, const N: usize>(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut [U; N]) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_into_string(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut String) -> u64
/// Decrypts the data with the padding defined according to ISO 7816-4
/// in ECB (Electronic CodeBook) mode, and stores the decrypted data
/// in a `String`.
///
/// # Arguments
/// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
/// and is the place where the ciphertext to be decrypted is stored.
/// - `length_in_bytes` is of `u64`-type,
/// and is the length of the ciphertext `cipher` in bytes.
/// - `message` is a mutable reference to a `String` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `length_in_bytes` is greater than `8` (which means
/// that the original plaintext is surely not empty data) and it returns
/// `zero`, you can interpret it that this method surely failed in
/// decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as decrypt_*_into_string().
/// - This method is useful to use in hybrid programming with C/C++.
/// - `length_in_bytes` cannot be other than any multiple of `8`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
/// - This method assumes that the original plaintext is a string
/// in the format of UTF-8.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B (16 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B (128 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = String::new();
/// let mut recovered2 = String::new();
/// c_des.decrypt_into_string(cipher1.as_ptr(), cipher1.len() as u64, &mut recovered1);
/// d_des.decrypt_into_string(cipher2.as_ptr(), cipher2.len() as u64, &mut recovered2);
/// println!("B1 (0 rounds) =\t{}", recovered1);
/// println!("B2 (0 rounds) =\t{}", recovered2);
/// assert_eq!(recovered1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered1, message);
/// assert_eq!(recovered2, message);
/// assert_eq!(recovered1, recovered2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 5 for NNormal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "7 bytes");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "I am OK.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "PARK Youngho");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_into_string(cipher.as_ptr(), cipher.len() as u64, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "고맙습니다.");
/// assert_eq!(recovered, message);
/// ```
pub fn decrypt_into_string(&mut self, cipher: *const u8, length_in_bytes: u64, message: &mut String) -> u64
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_vec<U>(&mut self, cipher: &Vec<U>, message: *mut u8) -> u64
/// Decrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `cipher` is an immutable reference to `Vec<U>` object, and
/// is the place where the plaintext to be decrypted is stored.
/// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `cipher.len()` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as decrypt_vec_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - `size_of::<U>()` * `cipher.len()` cannot be other than any multiple
/// of `8`.
/// - The size of the memory area which starts at `message` is assumed to
/// be enough to store the plaintext. So, it is responsible for you to
/// prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `size_of::<U>()` * `cipher.len()` - `1`.
/// - If the size of the area for plaintext is prepared more than
/// `size_of::<U>()` * `cipher.len()` - `1`, the rest of the area will be
/// filled with `0`s.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = vec![0; 55];
/// a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = vec![0; 55];
/// a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = vec![0; 55];
/// let mut recovered2 = vec![0; 55];
/// c_des.decrypt_vec(&cipher1, recovered1.as_mut_ptr());
/// d_des.decrypt_vec(&cipher2, recovered2.as_mut_ptr());
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 24];
/// let len = a_des.decrypt_vec(&cipher, recovered.as_mut_ptr());
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
/// converted.truncate(len as usize);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_vec<U>(&mut self, cipher: &Vec<U>, message: *mut u8) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_vec_into_vec<U, V>(&mut self, cipher: &Vec<U>, message: &mut Vec<V>) -> u64
/// Decrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and
/// stores the decrypted data in `Vec<V>`.
///
/// # Arguments
/// - `cipher` is an immutable reference to `Vec<U>` object, and
/// is the place where the ciphertext to be decrypted is stored.
/// - `message` is a mutable reference to `Vec<U>` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `cipher.len()` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = Vec::<u8>::new();
/// let mut recovered2 = Vec::<u8>::new();
/// c_des.decrypt_vec_into_vec(&cipher1, &mut recovered1);
/// d_des.decrypt_vec_into_vec(&cipher2, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_vec_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_vec_into_vec<U, V>(&mut self, cipher: &Vec<U>, message: &mut Vec<V>) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_vec_into_array<U, V, const N: usize>(&mut self, cipher: &Vec<U>, message: &mut [V; N]) -> u64
/// Decrypts the data stored in a `Vec<U>` object with the padding defined
/// according to ISO 7816-4 in ECB (Electronic CodeBook) mode, and
/// stores the decrypted data in array `[V; N]`.
///
/// # Arguments
/// - `cipher` is an immutable reference to `Vec<U>` object, and
/// is the place where the ciphertext to be decrypted is stored.
/// - `message` is a mutable reference to an array `[U; N]` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `cipher.len()` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - If `size_of::<V>()` * `N` is less than
/// `size_of::<U>()` * `cipher.len()` - `1`, this method does not perform
/// decryption but returns `zero`.
/// - If `size_of::<V>()` * `N` is equal to or greater than
/// `size_of::<U>()` * `cipher.len()` - `1`, this method performs
/// decryption, fills the array `message` with the decrypted data, and then
/// fills the rest of the elements of the array `message` with zeros, and
/// returns the size of the plaintext.
/// - It is responsible for you to prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `size_of::<U>()` * `cipher.len()` - `1`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = [0u8; 56];
/// let mut recovered2 = [0u8; 56];
/// let len1 = c_des.decrypt_vec_into_array(&cipher1, &mut recovered1);
/// let len2 = d_des.decrypt_vec_into_array(&cipher2, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.write(&recovered1);
/// unsafe { converted2.as_mut_vec() }.write(&recovered2);
/// unsafe { converted1.as_mut_vec() }.truncate(len1 as usize);
/// unsafe { converted2.as_mut_vec() }.truncate(len2 as usize);
/// println!("B1b (0 rounds) =\t{}", converted1);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 24];
/// let len = a_des.decrypt_vec_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_vec_into_array<U, V, const N: usize>(&mut self, cipher: &Vec<U>, message: &mut [V; N]) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_vec_into_string(&mut self, cipher: &str, message: &mut String) -> u64
/// Decrypts the data in `str` with the padding defined according to
/// ISO 7816-4 in ECB (Electronic CodeBook) mode, and stores the
/// decrypted data in `String`.
///
/// # Arguments
/// - `cipher` is an immutable reference to `Vec<U>` object, and
/// is the place where the ciphertext to be decrypted is stored.
/// - `message` is a mutable reference to a `String` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `cipher.len()` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
/// - This method assumes that the original plaintext is a string
/// in the format of UTF-8.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B (16 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B (128 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = Vec::<u8>::new();
/// let mut cipher2 = Vec::<u8>::new();
/// c_des.encrypt_str_into_vec(&message, &mut cipher1);
/// d_des.encrypt_str_into_vec(&message, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = String::new();
/// let mut recovered2 = String::new();
/// c_des.decrypt_vec_into_string(&cipher1, &mut recovered1);
/// d_des.decrypt_vec_into_string(&cipher2, &mut recovered2);
/// println!("B1 (0 rounds) =\t{}", recovered1);
/// println!("B2 (0 rounds) =\t{}", recovered2);
/// assert_eq!(recovered1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered1, message);
/// assert_eq!(recovered2, message);
/// assert_eq!(recovered1, recovered2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "7 bytes");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "I am OK.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "PARK Youngho");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = Vec::<u8>::new();
/// a_des.encrypt_str_into_vec(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_vec_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "고맙습니다.");
/// assert_eq!(recovered, message);
/// ```
pub fn decrypt_vec_into_string<U>(&mut self, cipher: &Vec<U>, message: &mut String) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_array<U, const N: usize>(&mut self, cipher: &[U; N], message: *mut u8) -> u64
/// Decrypts the data stored in an array `[U; N]` object with the padding
/// defined according to ISO 7816-4 in ECB (Electronic CodeBook) mode.
///
/// # Arguments
/// - `cipher` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be decrypted is stored.
/// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `N` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - You are not encouraged to use this method in pure Rust programming.
/// Instead, use other safer methods such as decrypt_array_into_*().
/// - This method is useful to use in hybrid programming with C/C++.
/// - `size_of::<U>()` * `N` cannot be other than any multiple
/// of `8`.
/// - The size of the memory area which starts at `message` is assumed to
/// be enough to store the plaintext. So, it is responsible for you to
/// prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `size_of::<U>()` * `N` - `1`.
/// - If the size of the area for plaintext is prepared more than
/// `size_of::<U>()` * `N` - `1`, the rest of the area will be
/// filled with `0`s.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = vec![0; 55];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = vec![0; 55];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = vec![0; 55];
/// let mut recovered2 = vec![0; 55];
/// let len1 = c_des.decrypt_array(&cipher1, recovered1.as_mut_ptr());
/// let len2 = d_des.decrypt_array(&cipher2, recovered2.as_mut_ptr());
/// recovered1.truncate(len1 as usize);
/// recovered2.truncate(len2 as usize);
///
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = vec![0; 8];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = vec![0; 16];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = vec![0; 24];
/// let len = a_des.decrypt_array(&cipher, recovered.as_mut_ptr());
/// recovered.truncate(len as usize);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_array<U, const N: usize>(&mut self, cipher: &[U; N], message: *mut u8) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_array_into_vec<U, V, const N: usize>(&mut self, cipher: &[U; N], message: &mut Vec<V>) -> u64
/// Decrypts the data stored in an array `[U; N]` object with the padding
/// defined according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the decrypted data in `Vec<V>`.
///
/// # Arguments
/// - `cipher` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be decrypted is stored.
/// - `message` is a mutable reference to `Vec<U>` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `N` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba (128 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb (128 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = Vec::<u8>::new();
/// let mut recovered2 = Vec::<u8>::new();
/// c_des.decrypt_array_into_vec(&cipher1, &mut recovered1);
/// d_des.decrypt_array_into_vec(&cipher2, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.append(&mut recovered1);
/// unsafe { converted2.as_mut_vec() }.append(&mut recovered2);
///
/// println!("B1b (0 rounds) =\t{}", converted1);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted1);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = Vec::<u8>::new();
/// a_des.decrypt_array_into_vec(&cipher, &mut recovered);
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.append(&mut recovered);
///
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_array_into_vec<U, V, const N: usize>(&mut self, cipher: &[U; N], message: &mut Vec<V>) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, cipher: &[U; N], message: &mut [V; M]) -> u64
/// Decrypts the data stored in an array `[U; N]` object with the padding
/// defined according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the decrypted data in array `[V; M]`.
///
/// # Arguments
/// - `cipher` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be decrypted is stored.
/// - `message` is a mutable reference to an array `[U; N]` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `N` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - If `size_of::<V>()` * `M` is less than
/// `size_of::<U>()` * `N` - `1`, this method does not perform
/// decryption but returns `zero`.
/// - If `size_of::<V>()` * `M` is equal to or greater than
/// `size_of::<U>()` * `N` - `1`, this method performs decryption,
/// fills the array `message` with the decrypted data, and then
/// fills the rest of the elements of the array `message` with zeros, and
/// returns the size of the plaintext.
/// - It is responsible for you to prepare the `message` area big enough!
/// - The size of the area for plaintext does not have to be prepared more
/// than `size_of::<U>()` * `N` - `1`.
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = [0u8; 56];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
/// print!("Ba (16 rounds) =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb (16 rounds) =\t{}", converted);
/// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = [0u8; 56];
/// let mut recovered2 = [0u8; 56];
/// let len1 = c_des.decrypt_array_into_array(&cipher1, &mut recovered1);
/// let len2 = d_des.decrypt_array_into_array(&cipher2, &mut recovered2);
/// print!("B1a (0 rounds) =\t");
/// for b in recovered1.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
/// print!("B2a (0 rounds) =\t");
/// for b in recovered2.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 6E 20 74 68 65 20 62 65 67 69 6E 6E 69 6E 67 20 47 6F 64 20 63 72 65 61 74 65 64 20 74 68 65 20 68 65 61 76 65 6E 73 20 61 6E 64 20 74 68 65 20 65 61 72 74 68 2E 00 ");
///
/// let mut converted1 = String::new();
/// let mut converted2 = String::new();
/// unsafe { converted1.as_mut_vec() }.write(&recovered1);
/// unsafe { converted2.as_mut_vec() }.write(&recovered2);
/// unsafe { converted1.as_mut_vec() }.truncate(len1 as usize);
/// unsafe { converted2.as_mut_vec() }.truncate(len2 as usize);
/// println!("B1b (0 rounds) =\t{}", converted1);
/// println!("B2b (0 rounds) =\t{}", converted2);
/// assert_eq!(converted1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(converted1, message);
/// assert_eq!(converted2, message);
/// assert_eq!(converted1, converted2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = [0u8; 8];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "37 20 62 79 74 65 73 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "7 bytes");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "49 20 61 6D 20 4F 4B 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "I am OK.");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = [0u8; 16];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "50 41 52 4B 20 59 6F 75 6E 67 68 6F 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "PARK Youngho");
/// assert_eq!(converted, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = [0u8; 24];
/// let len = a_des.decrypt_array_into_array(&cipher, &mut recovered);
///
/// print!("Ba =\t");
/// for b in recovered.clone()
/// { print!("{:02X} ", b); }
/// println!();
/// let mut txt = String::new();
/// for c in recovered.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "EA B3 A0 EB A7 99 EC 8A B5 EB 8B 88 EB 8B A4 2E 00 00 00 00 00 00 00 00 ");
///
/// let mut converted = String::new();
/// unsafe { converted.as_mut_vec() }.write(&recovered);
/// unsafe { converted.as_mut_vec() }.truncate(len as usize);
/// println!("Bb =\t{}", converted);
/// assert_eq!(converted, "고맙습니다.");
/// assert_eq!(converted, message);
/// ```
pub fn decrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, cipher: &[U; N], message: &mut [V; M]) -> u64
where U: SmallUInt, V: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
// fn decrypt_array_into_string<U, const N: usize>(&mut self, cipher: &[U; N], message: &mut String) -> u64
/// Decrypts the data stored in an array `[U; N]` object with the padding
/// defined according to ISO 7816-4 in ECB (Electronic CodeBook) mode,
/// and stores the decrypted data in `String`.
///
/// # Arguments
/// - `cipher` is an immutable reference to an array `[U; N]` object, and
/// is the place where the plaintext to be decrypted is stored.
/// - `message` is a mutable reference to a `String` object, and
/// is the place where the decrypted data will be stored.
///
/// # Output
/// - This method returns the size of plaintext in bytes.
/// - If this method failed in decryption, it always returns `zero`.
/// - Even if this method succeeded in decryption, it returns `zero` when
/// the original plaintext is zero-length empty data. Then, you will have
/// to check whether or not it failed by using the method
/// `is_successful()` or `is_failed()`.
/// - If `size_of::<U>()` * `N` is greater than `8`
/// (which means that the original plaintext is surely not empty data)
/// and it returns `zero`, you can interpret it that this method surely
/// failed in decryption.
///
/// # Features
/// - The padding bits are composed of the byte `0b_1000_0000` that
/// indicates the delimiter one bit `1` followed by seven bits `0`s and
/// all padding bits `0`s according to ISO 7816-4.
/// - For more information about the padding bits according to ISO 7816-4,
/// Read [here](https://en.wikipedia.org/wiki/Padding_(cryptography)#ISO/IEC_7816-4).
/// - You don't have to worry about whether or not the size of the memory
/// area where the ciphertext will be stored is enough.
/// - This method assumes that the original plaintext is a string
/// in the format of UTF-8.
///
/// # Example 1 for Normal case
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (16 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "6F 10 01 6D 99 BF 41 F8 BC 00 A8 1D 81 B7 4B 20 6F B5 30 0A 14 03 A9 8E 69 E7 A6 33 42 AF 97 59 ED 9D E0 95 35 DC DF 0D 99 58 FA 92 13 50 4D 50 F4 BE 6B A5 C5 7D F6 5D ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B (16 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 2 for Expanded case for 128 rounds
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES_Expanded::<128, 0x_8103_8103_8103_8103_8103_8103_8103_8103_u128>::new_with_key_u64(key);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 56];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C (128 rounds) =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "DD C6 D8 D1 B0 66 D9 AC F7 F3 B4 FD D6 6C ED 78 20 FB A6 8D 35 38 EA 65 B0 65 23 05 FF D4 53 B1 D1 E0 C5 52 36 1E AC E2 19 EF 94 B8 98 04 A9 69 22 62 41 CF 85 0E E5 3F ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B (128 rounds) =\t{}", recovered);
/// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 3 for Expanded case for 0 rounds which means that key is meaningless
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES_Expanded, ECB_ISO };
///
/// let key1 = 0x_1234567890ABCDEF_u64;
/// let key2 = 0_u64;
/// println!("K1 =\t{:#016X}", key1);
/// println!("K2 =\t{:#016X}", key2);
/// let mut c_des = DES_Expanded::<0, 0>::new_with_key_u64(key1);
/// let mut d_des = DES_Expanded::<0, 0>::new_with_key_u64(key2);
///
/// let message = "In the beginning God created the heavens and the earth.";
/// println!("M =\t{}", message);
/// let mut cipher1 = [0_u8; 56];
/// let mut cipher2 = [0_u8; 56];
/// c_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher1);
/// d_des.encrypt_into_array(message.as_ptr(), message.len() as u64, &mut cipher2);
/// print!("C (0 rounds) =\t");
/// for c in cipher1.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher1.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
/// print!("D (0 rounds) =\t");
/// for c in cipher2.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher2.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "86 9D 10 B8 94 9A 10 91 9A 9B 96 9D 9D 96 9D 9B 10 8B 9F 98 10 93 B1 9A 92 B8 9A 98 10 B8 94 9A 10 94 9A 92 B9 9A 9D B3 10 92 9D 98 10 B8 94 9A 10 9A 92 B1 B8 94 1D 40 ");
///
/// let mut recovered1 = String::new();
/// let mut recovered2 = String::new();
/// c_des.decrypt_array_into_string(&cipher1, &mut recovered1);
/// d_des.decrypt_array_into_string(&cipher2, &mut recovered2);
/// println!("B1 (0 rounds) =\t{}", recovered1);
/// println!("B2 (0 rounds) =\t{}", recovered2);
/// assert_eq!(recovered1, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered2, "In the beginning God created the heavens and the earth.");
/// assert_eq!(recovered1, message);
/// assert_eq!(recovered2, message);
/// assert_eq!(recovered1, recovered2);
/// ```
///
/// # Example 4 for Normal case for the message of 0 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 5 for Normal case for the message shorter than 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "7 bytes";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 8];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "ED 30 F1 06 B7 E3 E7 07 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "7 bytes");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 6 for Normal case for the message of 8 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "I am OK.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "27 F5 93 EE 76 DC 64 87 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "I am OK.");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 7 for Normal case for the message longer than 8 bytes and shorter than 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "PARK Youngho";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 16];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "8E 52 20 47 78 78 51 B7 BB 55 6A 78 71 84 72 58 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "PARK Youngho");
/// assert_eq!(recovered, message);
/// ```
///
/// # Example 8 for Normal case for the message of 16 bytes
/// ```
/// use std::io::Write;
/// use std::fmt::Write as _;
/// use cryptocol::symmetric::{ DES, ECB_ISO };
///
/// let key = 0x_1234567890ABCDEF_u64;
/// println!("K =\t{:#016X}", key);
/// let mut a_des = DES::new_with_key_u64(key);
///
/// let message = "고맙습니다.";
/// println!("M =\t{}", message);
/// let mut cipher = [0_u8; 24];
/// a_des.encrypt_str_into_array(&message, &mut cipher);
/// print!("C =\t");
/// for c in cipher.clone()
/// { print!("{:02X} ", c); }
/// println!();
/// let mut txt = String::new();
/// for c in cipher.clone()
/// { write!(txt, "{:02X} ", c); }
/// assert_eq!(txt, "20 83 6B 12 1D 3A 5D BA 4D D6 5F 5A 8E 2E AC E7 E2 22 32 FE 87 E8 0A 93 ");
///
/// let mut recovered = String::new();
/// a_des.decrypt_array_into_string(&cipher, &mut recovered);
/// println!("B =\t{}", recovered);
/// assert_eq!(recovered, "고맙습니다.");
/// assert_eq!(recovered, message);
/// ```
pub fn decrypt_array_into_string<U, const N: usize>(&mut self, cipher: &[U; N], message: &mut String) -> u64
where U: SmallUInt
{
unimplemented!(); // Dummy code for documentation
}
}