cryptocol/symmetric/
trait_pcbc_with_padding_pkcs7.rs

1// Copyright 2025 PARK Youngho.
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
6// This file may not be copied, modified, or distributed
7// except according to those terms.
8
9
10#![allow(missing_docs)]
11#![allow(unused_must_use)]
12#![allow(dead_code)]
13#![allow(unused_variables)]
14// #![warn(rustdoc::missing_doc_code_examples)]
15
16
17use std::vec::Vec;
18use crate::number::SmallUInt;
19use crate::symmetric::pre_decrypt_into_vec;
20
21
22
23/// PCBC (Propagation Cipher-Block Chaining) is one of the operation modes
24///  forencryption/decryption. And PKCS #7 is the one of the padding ways.
25/// 
26/// # Caution
27/// For Rijndael or AES, if NB > 64, you are not supposed to use the padding
28/// defined in PKCS #7 because its behavior is not defined.
29#[allow(non_camel_case_types)]
30pub trait PCBC_PKCS7<T> : Sized
31{
32    // fn encrypt(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: *mut u8) -> u64;
33    /// Encrypts the data with the padding defined according to PKCS #7
34    /// in PCBC (Propagation Cipher-Block Chaining) mode.
35    /// 
36    /// # Arguments
37    /// - `iv` is an initialization vector for PCBC mode.
38    /// - `message` is an immutable pointer to `u8` which is `*const u8`,
39    ///   and is the place where the plaintext to be encrypted is stored.
40    /// - `length_in_bytes` is of `u64`-type,
41    ///   and is the length of the plaintext `message` in bytes.
42    /// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
43    ///   is the place where the encrypted data will be stored.
44    /// 
45    /// # Output
46    /// - This method returns the size of ciphertext including padding bits
47    ///   in bytes.
48    /// - The output will be at least `size_of::<T>()`,
49    ///   and cannot be other than a multiple of `size_of::<T>()`.
50    /// - If this method failed in encryption,
51    ///   this method returns `zero`.
52    /// 
53    /// # Features
54    /// - You are not encouraged to use this method in pure Rust programming.
55    ///   Instead, use other safer methods such as `encrypt_*_into_*()`.
56    /// - This method is useful to use in hybrid programming with C/C++.
57    /// - If `length_in_bytes` is `0`, it means the message is null string.
58    ///   So, only padding bytes will be encrypted,
59    ///   and stored in the memory area that starts from `cipher`.
60    /// - The size of the memory area which starts at `cipher` is assumed to be
61    ///   enough to store the ciphertext.
62    /// - The size of the area for ciphertext should be prepared to be
63    ///   (`length_in_bytes` + `1`).next_multiple_of(`size_of::<T>()`) at least.
64    ///   So, it is responsible for you to prepare the `cipher` area big enough!
65    /// - The padding bits are composed of the bytes that indicate the length of
66    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
67    /// - For more information about the padding bits according to PKCS #7,
68    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
69    /// 
70    /// # For Rijndael or AES, and its variants
71    /// ## Example 1 for AES-128
72    /// ```
73    /// use std::io::Write;
74    /// use std::fmt::Write as _;
75    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
76    /// 
77    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
78    /// println!("K =\t{:#016X}", key);
79    /// let mut a_aes = AES_128::new_with_key_u128(key);
80    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
81    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
82    /// 
83    /// let message = "In the beginning God created the heavens and the earth.";
84    /// println!("M =\t{}", message);
85    /// let mut cipher = [0_u8; 64];
86    /// a_aes.encrypt(iv, message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
87    /// print!("C =\t");
88    /// for c in cipher.clone()
89    ///     { print!("{:02X} ", c); }
90    /// println!();
91    /// let mut txt = String::new();
92    /// for c in cipher.clone()
93    ///     { write!(txt, "{:02X} ", c); }
94    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
95    /// ```
96    /// 
97    /// ## For more examples,
98    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt)
99    /// 
100    /// # For DES and its variants
101    /// ## Example 1 for Normal case
102    /// ```
103    /// use std::io::Write;
104    /// use std::fmt::Write as _;
105    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
106    /// 
107    /// let key = 0x_1234567890ABCDEF_u64;
108    /// println!("K =\t{:#016X}", key);
109    /// let mut a_des = DES::new_with_key_u64(key);
110    /// 
111    /// let message = "In the beginning God created the heavens and the earth.";
112    /// println!("M =\t{}", message);
113    /// let iv = 0x_FEDCBA0987654321_u64;
114    /// println!("IV =	{}", iv);
115    /// let mut cipher = [0_u8; 56];
116    /// a_des.encrypt(iv, message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
117    /// print!("C (16 rounds) =\t");
118    /// for c in cipher.clone()
119    ///     { print!("{:02X} ", c); }
120    /// println!();
121    /// let mut txt = String::new();
122    /// for c in cipher.clone()
123    ///     { write!(txt, "{:02X} ", c); }
124    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
125    /// ```
126    /// 
127    /// ## For more examples,
128    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt)
129    /// 
130    /// # For BigCryptor128
131    /// ## Example 1 for TAES case
132    /// ```
133    /// use std::io::Write;
134    /// use std::fmt::Write as _;
135    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
136    /// 
137    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
138    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
139    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
140    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
141    /// println!("IV =	{:#034X}", iv);
142    /// let message = "In the beginning God created the heavens and the earth.";
143    /// println!("M =\t{}", message);
144    /// let mut cipher = [0_u8; 64];
145    /// taes.encrypt(iv, message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
146    /// print!("C =\t");
147    /// for c in cipher.clone()
148    ///     { print!("{:02X} ", c); }
149    /// println!();
150    /// let mut txt = String::new();
151    /// for c in cipher.clone()
152    ///     { write!(txt, "{:02X} ", c); }
153    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
154    /// ```
155    /// 
156    /// ## For more examples,
157    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt)
158    /// 
159    /// # For BigCryptor64
160    /// ## Example 1 for TDES case
161    /// ```
162    /// use std::io::Write;
163    /// use std::fmt::Write as _;
164    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
165    /// 
166    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
167    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
168    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
169    /// let iv = 0x_FEDCBA0987654321_u64;
170    /// println!("IV =	{:#018X}", iv);
171    /// let message = "In the beginning God created the heavens and the earth.";
172    /// println!("M =\t{}", message);
173    /// let mut cipher = [0_u8; 56];
174    /// tdes.encrypt(iv, message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
175    /// print!("C =\t");
176    /// for c in cipher.clone()
177    ///     { print!("{:02X} ", c); }
178    /// println!();
179    /// let mut txt = String::new();
180    /// for c in cipher.clone()
181    ///     { write!(txt, "{:02X} ", c); }
182    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
183    /// ```
184    /// 
185    /// ## For more examples,
186    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt)
187    fn encrypt(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: *mut u8) -> u64;
188
189    // fn encrypt_into_vec<U>(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: &mut Vec<U>) -> u64
190    /// Encrypts the data with the padding defined according to PKCS #7
191    /// in PCBC (Propagation Cipher-Block Chaining) mode, and stores the encrypted data
192    /// in `Vec<U>`.
193    /// 
194    /// # Arguments
195    /// - `iv` is an initialization vector for PCBC mode.
196    /// - `message` is an immutable pointer to `u8` which is `*const u8`,
197    ///   and is the place where the plaintext to be encrypted is stored.
198    /// - `length_in_bytes` is of `u64`-type,
199    ///   and is the length of the plaintext `message` in bytes.
200    /// - `cipher` is a mutable reference to `Vec<U>` object, and
201    ///   is the place where the encrypted data will be stored.
202    /// 
203    /// # Output
204    /// - This method returns the size of ciphertext including padding bits
205    ///   in bytes.
206    /// - The output will be at least `size_of::<T>()`,
207    ///   and cannot be other than a multiple of `size_of::<T>()`.
208    /// - If this method failed in encryption,
209    ///   this method returns `zero`.
210    /// 
211    /// # Features
212    /// - You are not encouraged to use this method in pure Rust programming.
213    ///   Instead, use other safer methods such as encrypt_*_into_vec().
214    /// - This method is useful to use in hybrid programming with C/C++.
215    /// - If `length_in_bytes` is `0`, it means the message is a null string.
216    ///   So, only padding bytes will be encrypted,
217    ///   and stored in the `Vec<U>` object which is referred to as `cipher`.
218    /// - The padding bits are composed of the bytes that indicate the length of
219    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
220    /// - For more information about the padding bits according to PKCS #7,
221    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
222    /// - You don't have to worry about whether or not the size of the memory
223    ///   area where the ciphertext will be stored is enough.
224    /// 
225    /// # For Rijndael or AES, and its variants
226    /// ## Example 1 for AES-128
227    /// ```
228    /// use std::io::Write;
229    /// use std::fmt::Write as _;
230    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
231    /// 
232    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
233    /// println!("K =\t{:#016X}", key);
234    /// let mut a_aes = AES_128::new_with_key_u128(key);
235    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
236    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
237    /// 
238    /// let message = "In the beginning God created the heavens and the earth.";
239    /// println!("M =\t{}", message);
240    /// let mut cipher = Vec::<u8>::new();
241    /// a_aes.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, &mut cipher);
242    /// print!("C =\t");
243    /// for c in cipher.clone()
244    ///     { print!("{:02X} ", c); }
245    /// println!();
246    /// let mut txt = String::new();
247    /// for c in cipher.clone()
248    ///     { write!(txt, "{:02X} ", c); }
249    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
250    /// ```
251    /// 
252    /// ## For more examples,
253    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_into_vec)
254    /// 
255    /// # For DES and its variants
256    /// ## Example 1 for Normal case
257    /// ```
258    /// use std::io::Write;
259    /// use std::fmt::Write as _;
260    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
261    /// 
262    /// let key = 0x_1234567890ABCDEF_u64;
263    /// println!("K =\t{:#016X}", key);
264    /// let mut a_des = DES::new_with_key_u64(key);
265    ///
266    /// let message = "In the beginning God created the heavens and the earth.";
267    /// println!("M =\t{}", message);
268    /// let iv = 0x_FEDCBA0987654321_u64;
269    /// println!("IV =	{}", iv);
270    /// let mut cipher = Vec::<u8>::new();
271    /// a_des.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, &mut cipher);
272    /// print!("C (16 rounds) =\t");
273    /// for c in cipher.clone()
274    ///     { print!("{:02X} ", c); }
275    /// println!();
276    /// let mut txt = String::new();
277    /// for c in cipher.clone()
278    ///     { write!(txt, "{:02X} ", c); }
279    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
280    /// ```
281    /// 
282    /// ## For more examples,
283    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_into_vec)
284    /// 
285    /// # For BigCryptor128
286    /// ## Example 1 for TAES case
287    /// ```
288    /// use std::io::Write;
289    /// use std::fmt::Write as _;
290    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
291    /// 
292    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
293    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
294    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
295    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
296    /// println!("IV =	{:#034X}", iv);
297    /// let message = "In the beginning God created the heavens and the earth.";
298    /// println!("M =\t{}", message);
299    /// let mut cipher = Vec::<u8>::new();
300    /// taes.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, &mut cipher);
301    /// print!("C =\t");
302    /// for c in cipher.clone()
303    ///     { print!("{:02X} ", c); }
304    /// println!();
305    /// let mut txt = String::new();
306    /// for c in cipher.clone()
307    ///     { write!(txt, "{:02X} ", c); }
308    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
309    /// ```
310    /// 
311    /// ## For more examples,
312    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_into_vec)
313    /// 
314    /// # For BigCryptor64
315    /// ## Example 1 for TDES case
316    /// ```
317    /// use std::io::Write;
318    /// use std::fmt::Write as _;
319    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
320    /// 
321    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
322    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
323    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
324    /// let iv = 0x_FEDCBA0987654321_u64;
325    /// println!("IV =	{:#018X}", iv);
326    /// let message = "In the beginning God created the heavens and the earth.";
327    /// println!("M =\t{}", message);
328    /// let mut cipher = Vec::<u8>::new();
329    /// tdes.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, &mut cipher);
330    /// print!("C =\t");
331    /// for c in cipher.clone()
332    ///     { print!("{:02X} ", c); }
333    /// println!();
334    /// let mut txt = String::new();
335    /// for c in cipher.clone()
336    ///     { write!(txt, "{:02X} ", c); }
337    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
338    /// ```
339    /// 
340    /// ## For more examples,
341    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_into_vec)
342    fn encrypt_into_vec<U>(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: &mut Vec<U>) -> u64
343    where U: SmallUInt + Copy + Clone;
344
345    // fn encrypt_into_array<U, const N: usize>(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: &mut [U; N]) -> u64
346    /// Encrypts the data with the padding defined according to PKCS #7
347    /// in PCBC (Propagation Cipher-Block Chaining) mode, and stores the encrypted data
348    /// in array `[U; N]`.
349    /// 
350    /// # Arguments
351    /// - `iv` is an initialization vector for PCBC mode.
352    /// - `message` is an immutable pointer to `u8` which is `*const u8`,
353    ///   and is the place where the plaintext to be encrypted is stored.
354    /// - `length_in_bytes` is of `u64`-type,
355    ///   and is the length of the plaintext `message` in bytes.
356    /// - `cipher` is a mutable reference to an array `[U; N]` object, and
357    ///   is the place where the encrypted data will be stored.
358    /// 
359    /// # Output
360    /// - This method returns the size of ciphertext including padding bits
361    ///   in bytes.
362    /// - The output will be at least `size_of::<T>()`,
363    ///   and cannot be other than a multiple of `size_of::<T>()`.
364    /// - If this method failed in encryption, this method returns `zero`.
365    /// 
366    /// # Features
367    /// - You are not encouraged to use this method in pure Rust programming.
368    ///   Instead, use other safer methods such as encrypt_*_into_array().
369    /// - This method is useful to use in hybrid programming with C/C++.
370    /// - If `length_in_bytes` is `0`, it means the message is null data.
371    ///   So, only padding bytes will be encrypted,
372    ///   and stored in the array `[U; N]` object `cipher`.
373    /// - If `U::size_in_bytes()` * `N` is less than `length_in_bytes`'s next
374    ///   multiple of `size_of::<T>()`, this method does not perform
375    ///   encryption but returns `zero`.
376    /// - If `U::size_in_bytes()` * `N` is equal to `length_in_bytes`'s next
377    ///   multiple of `size_of::<T>()`, this method performs encryption,
378    ///   fills the array `cipher` with the encrypted data, and returns
379    ///   the size of the ciphertext including padding bits in bytes.
380    /// - If `U::size_in_bytes()` * `N` is greater than `length_in_bytes`'s next
381    ///   multiple of `size_of::<T>()`, this method performs encryption, fills
382    ///   the array `cipher` with the encrypted data, and then fills the
383    ///   rest of the elements of the array `cipher` with zeros, and returns
384    ///   the size of the ciphertext including padding bits in bytes.
385    /// - The size of the area for ciphertext should be prepared to be
386    ///   (`length_in_bytes` + `1`).next_multiple_of(`size_of::<T>()`) at least.
387    ///   So, it is responsible for you to prepare the `cipher` area big enough!
388    /// - The padding bits are composed of the bytes that indicate the length of
389    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
390    /// - For more information about the padding bits according to PKCS #7,
391    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
392    /// 
393    /// # For Rijndael or AES, and its variants
394    /// ## Example 1 for AES-128
395    /// ```
396    /// use std::io::Write;
397    /// use std::fmt::Write as _;
398    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
399    /// 
400    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
401    /// println!("K =\t{:#016X}", key);
402    /// let mut a_aes = AES_128::new_with_key_u128(key);
403    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
404    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
405    /// 
406    /// let message = "In the beginning God created the heavens and the earth.";
407    /// println!("M =\t{}", message);
408    /// let mut cipher = [0_u8; 64];
409    /// a_aes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
410    /// print!("C =\t");
411    /// for c in cipher.clone()
412    ///     { print!("{:02X} ", c); }
413    /// println!();
414    /// let mut txt = String::new();
415    /// for c in cipher.clone()
416    ///     { write!(txt, "{:02X} ", c); }
417    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
418    /// ```
419    /// 
420    /// ## For more examples,
421    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_into_array)
422    /// 
423    /// # For DES and its variants
424    /// ## Example 1 for Normal case
425    /// ```
426    /// use std::io::Write;
427    /// use std::fmt::Write as _;
428    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
429    /// 
430    /// let key = 0x_1234567890ABCDEF_u64;
431    /// println!("K =\t{:#016X}", key);
432    /// let mut a_des = DES::new_with_key_u64(key);
433    ///
434    /// let message = "In the beginning God created the heavens and the earth.";
435    /// println!("M =\t{}", message);
436    /// let iv = 0x_FEDCBA0987654321_u64;
437    /// println!("IV =	{}", iv);
438    /// let mut cipher = [0_u8; 56];
439    /// a_des.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
440    /// print!("C (16 rounds) =\t");
441    /// for c in cipher.clone()
442    ///     { print!("{:02X} ", c); }
443    /// println!();
444    /// let mut txt = String::new();
445    /// for c in cipher.clone()
446    ///     { write!(txt, "{:02X} ", c); }
447    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
448    /// ```
449    /// 
450    /// ## For more examples,
451    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_into_array)
452    /// 
453    /// # For BigCryptor128
454    /// ## Example 1 for TAES case
455    /// ```
456    /// use std::io::Write;
457    /// use std::fmt::Write as _;
458    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
459    /// 
460    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
461    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
462    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
463    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
464    /// println!("IV =	{:#034X}", iv);
465    /// let message = "In the beginning God created the heavens and the earth.";
466    /// println!("M =\t{}", message);
467    /// let mut cipher = [0_u8; 64];
468    /// taes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
469    /// print!("C =\t");
470    /// for c in cipher.clone()
471    ///     { print!("{:02X} ", c); }
472    /// println!();
473    /// let mut txt = String::new();
474    /// for c in cipher.clone()
475    ///     { write!(txt, "{:02X} ", c); }
476    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
477    /// ```
478    /// 
479    /// ## For more examples,
480    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_into_array)
481    /// 
482    /// # For BigCryptor64
483    /// ## Example 1 for TDES case
484    /// ```
485    /// use std::io::Write;
486    /// use std::fmt::Write as _;
487    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
488    /// 
489    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
490    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
491    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
492    /// let iv = 0x_FEDCBA0987654321_u64;
493    /// println!("IV =	{:#018X}", iv);
494    /// let message = "In the beginning God created the heavens and the earth.";
495    /// println!("M =\t{}", message);
496    /// let mut cipher = [0_u8; 56];
497    /// tdes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
498    /// print!("C =\t");
499    /// for c in cipher.clone()
500    ///     { print!("{:02X} ", c); }
501    /// println!();
502    /// let mut txt = String::new();
503    /// for c in cipher.clone()
504    ///     { write!(txt, "{:02X} ", c); }
505    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
506    /// ```
507    /// 
508    /// ## For more examples,
509    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_into_array)
510    fn encrypt_into_array<U, const N: usize>(&mut self, iv: T, message: *const u8, length_in_bytes: u64, cipher: &mut [U; N]) -> u64
511    where U: SmallUInt + Copy + Clone;
512
513    // fn encrypt_str(&mut self, iv: T, message: &str, cipher: *mut u8) -> u64
514    /// Encrypts the data in a `str` object with the padding defined
515    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
516    /// 
517    /// # Arguments
518    /// - `iv` is an initialization vector for PCBC mode.
519    /// - `message` is an immutable reference to `str` object which is `&str`,
520    ///   and is the place where the plaintext to be encrypted is stored.
521    /// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
522    ///   is the place where the encrypted data will be stored.
523    /// 
524    /// # Output
525    /// - This method returns the size of ciphertext including padding bits
526    ///   in bytes.
527    /// - The output will be at least `size_of::<T>()`,
528    ///   and cannot be other than a multiple of `size_of::<T>()`.
529    /// - If this method failed in encryption, this method returns `zero`.
530    /// 
531    /// # Features
532    /// - You are not encouraged to use this method in pure Rust programming.
533    ///   Instead, use other safer methods such as encrypt_str_into_*().
534    /// - This method is useful to use in hybrid programming with C/C++.
535    /// - If `message` is a null string "", only padding bytes will be encrypted,
536    ///   and stored in the memory area that starts from `cipher`.
537    /// - The size of the memory area which starts at `cipher` is assumed to be
538    ///   enough to store the ciphertext.
539    /// - The size of the area for ciphertext should be prepared to be
540    ///   (`message.len()` + `1`).next_multiple_of(`size_of::<T>()`) at least.
541    ///   So, it is responsible for you to prepare the `cipher` area big enough!
542    /// - The padding bits are composed of the bytes that indicate the length of
543    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
544    /// - For more information about the padding bits according to PKCS #7,
545    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
546    /// 
547    /// # For Rijndael or AES, and its variants
548    /// ## Example 1 for AES-128
549    /// ```
550    /// use std::io::Write;
551    /// use std::fmt::Write as _;
552    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
553    /// 
554    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
555    /// println!("K =\t{:#016X}", key);
556    /// let mut a_aes = AES_128::new_with_key_u128(key);
557    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
558    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
559    /// 
560    /// let message = "In the beginning God created the heavens and the earth.";
561    /// println!("M =\t{}", message);
562    /// let mut cipher = [0_u8; 64];
563    /// a_aes.encrypt_str(iv, &message, cipher.as_mut_ptr());
564    /// print!("C =\t");
565    /// for c in cipher.clone()
566    ///     { print!("{:02X} ", c); }
567    /// println!();
568    /// let mut txt = String::new();
569    /// for c in cipher.clone()
570    ///     { write!(txt, "{:02X} ", c); }
571    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
572    /// ```
573    /// 
574    /// ## For more examples,
575    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_str)
576    /// 
577    /// # For DES and its variants
578    /// ## Example 1 for Normal case
579    /// ```
580    /// use std::io::Write;
581    /// use std::fmt::Write as _;
582    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
583    /// 
584    /// let key = 0x_1234567890ABCDEF_u64;
585    /// println!("K =\t{:#016X}", key);
586    /// let mut a_des = DES::new_with_key_u64(key);
587    ///
588    /// let message = "In the beginning God created the heavens and the earth.";
589    /// println!("M =\t{}", message);
590    /// let iv = 0x_FEDCBA0987654321_u64;
591    /// println!("IV =	{}", iv);
592    /// let mut cipher = [0_u8; 56];
593    /// a_des.encrypt_str(iv, &message, cipher.as_mut_ptr());
594    /// print!("C (16 rounds) =\t");
595    /// for c in cipher.clone()
596    ///     { print!("{:02X} ", c); }
597    /// println!();
598    /// let mut txt = String::new();
599    /// for c in cipher.clone()
600    ///     { write!(txt, "{:02X} ", c); }
601    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
602    /// ```
603    /// 
604    /// ## For more examples,
605    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_str)
606    /// 
607    /// # For BigCryptor128
608    /// ## Example 1 for TAES case
609    /// ```
610    /// use std::io::Write;
611    /// use std::fmt::Write as _;
612    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
613    /// 
614    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
615    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
616    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
617    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
618    /// println!("IV =	{:#034X}", iv);
619    /// let message = "In the beginning God created the heavens and the earth.";
620    /// println!("M =\t{}", message);
621    /// let mut cipher = [0_u8; 64];
622    /// taes.encrypt_str(iv, &message, cipher.as_mut_ptr());
623    /// print!("C =\t");
624    /// for c in cipher.clone()
625    ///     { print!("{:02X} ", c); }
626    /// println!();
627    /// let mut txt = String::new();
628    /// for c in cipher.clone()
629    ///     { write!(txt, "{:02X} ", c); }
630    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
631    /// ```
632    /// 
633    /// ## For more examples,
634    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_str)
635    /// 
636    /// # For BigCryptor64
637    /// ## Example 1 for TDES case
638    /// ```
639    /// use std::io::Write;
640    /// use std::fmt::Write as _;
641    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
642    /// 
643    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
644    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
645    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
646    /// let iv = 0x_FEDCBA0987654321_u64;
647    /// println!("IV =	{:#018X}", iv);
648    /// let message = "In the beginning God created the heavens and the earth.";
649    /// println!("M =\t{}", message);
650    /// let mut cipher = [0_u8; 56];
651    /// tdes.encrypt_str(iv, &message, cipher.as_mut_ptr());
652    /// print!("C =\t");
653    /// for c in cipher.clone()
654    ///     { print!("{:02X} ", c); }
655    /// println!();
656    /// let mut txt = String::new();
657    /// for c in cipher.clone()
658    ///     { write!(txt, "{:02X} ", c); }
659    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
660    /// ```
661    /// 
662    /// ## For more examples,
663    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_str)
664    #[inline]
665    fn encrypt_str(&mut self, iv: T, message: &str, cipher: *mut u8) -> u64
666    {
667        self.encrypt(iv, message.as_ptr(), message.len() as u64, cipher)
668    }
669
670    // fn encrypt_str_into_vec<U>(&mut self, iv: T, message: &str, cipher: &mut Vec<U>) -> u64
671    /// Encrypts the data in `str` with the padding defined according to
672    /// PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and stores the
673    /// encrypted data in `Vec<U>`.
674    /// 
675    /// # Arguments
676    /// - `iv` is an initialization vector for PCBC mode.
677    /// - `message` is an immutable reference to `str` object which is `&str`,
678    ///   and is the place where the plaintext to be encrypted is stored.
679    /// - `cipher` is a mutable reference to `Vec<U>` object, and
680    ///   is the place where the encrypted data will be stored.
681    /// 
682    /// # Output
683    /// - This method returns the size of ciphertext including padding bits
684    ///   in bytes.
685    /// - The output will be at least `size_of::<T>()`,
686    ///   and cannot be other than a multiple of `size_of::<T>()`.
687    /// - If this method failed in encryption, this method returns `zero`.
688    /// 
689    /// # Features
690    /// - If `message` is a null string "", only padding bytes will be encrypted,
691    ///   and stored in the `Vec<U>` object which is referred to as `cipher`.
692    /// - The padding bits are composed of the bytes that indicate the length of
693    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
694    /// - For more information about the padding bits according to PKCS #7,
695    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
696    /// - You don't have to worry about whether or not the size of the memory
697    ///   area where the ciphertext will be stored is enough.
698    /// 
699    /// # For Rijndael or AES, and its variants
700    /// ## Example 1 for AES-128
701    /// ```
702    /// use std::io::Write;
703    /// use std::fmt::Write as _;
704    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
705    /// 
706    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
707    /// println!("K =\t{:#016X}", key);
708    /// let mut a_aes = AES_128::new_with_key_u128(key);
709    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
710    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
711    /// 
712    /// let message = "In the beginning God created the heavens and the earth.";
713    /// println!("M =\t{}", message);
714    /// let mut cipher = Vec::<u8>::new();
715    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
716    /// print!("C =\t");
717    /// for c in cipher.clone()
718    ///     { print!("{:02X} ", c); }
719    /// println!();
720    /// let mut txt = String::new();
721    /// for c in cipher.clone()
722    ///     { write!(txt, "{:02X} ", c); }
723    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
724    /// ```
725    /// 
726    /// ## For more examples,
727    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_str_into_vec)
728    /// 
729    /// # For DES and its variants
730    /// ## Example 1 for Normal case
731    /// ```
732    /// use std::io::Write;
733    /// use std::fmt::Write as _;
734    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
735    /// 
736    /// let key = 0x_1234567890ABCDEF_u64;
737    /// println!("K =\t{:#016X}", key);
738    /// let mut a_des = DES::new_with_key_u64(key);
739    ///
740    /// let message = "In the beginning God created the heavens and the earth.";
741    /// println!("M =\t{}", message);
742    /// let iv = 0x_FEDCBA0987654321_u64;
743    /// println!("IV =	{}", iv);
744    /// let mut cipher = Vec::<u8>::new();
745    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
746    /// print!("C (16 rounds) =\t");
747    /// for c in cipher.clone()
748    ///     { print!("{:02X} ", c); }
749    /// println!();
750    /// let mut txt = String::new();
751    /// for c in cipher.clone()
752    ///     { write!(txt, "{:02X} ", c); }
753    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
754    /// ```
755    /// 
756    /// ## For more examples,
757    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_str_into_vec)
758    /// 
759    /// # For BigCryptor128
760    /// ## Example 1 for TAES case
761    /// ```
762    /// use std::io::Write;
763    /// use std::fmt::Write as _;
764    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
765    /// 
766    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
767    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
768    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
769    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
770    /// println!("IV =	{:#034X}", iv);
771    /// let message = "In the beginning God created the heavens and the earth.";
772    /// let mut cipher = Vec::<u8>::new();
773    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
774    /// print!("C =\t");
775    /// for c in cipher.clone()
776    ///     { print!("{:02X} ", c); }
777    /// println!();
778    /// let mut txt = String::new();
779    /// for c in cipher.clone()
780    ///     { write!(txt, "{:02X} ", c); }
781    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
782    /// ```
783    /// 
784    /// ## For more examples,
785    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_str_into_vec)
786    /// 
787    /// # For BigCryptor64
788    /// ## Example 1 for TDES case
789    /// ```
790    /// use std::io::Write;
791    /// use std::fmt::Write as _;
792    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
793    /// 
794    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
795    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
796    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
797    /// let iv = 0x_FEDCBA0987654321_u64;
798    /// println!("IV =	{:#018X}", iv);
799    /// let message = "In the beginning God created the heavens and the earth.";
800    /// let mut cipher = Vec::<u8>::new();
801    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
802    /// print!("C =\t");
803    /// for c in cipher.clone()
804    ///     { print!("{:02X} ", c); }
805    /// println!();
806    /// let mut txt = String::new();
807    /// for c in cipher.clone()
808    ///     { write!(txt, "{:02X} ", c); }
809    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
810    /// ```
811    /// 
812    /// ## For more examples,
813    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_str_into_vec)
814    #[inline]
815    fn encrypt_str_into_vec<U>(&mut self, iv: T, message: &str, cipher: &mut Vec<U>) -> u64
816    where U: SmallUInt + Copy + Clone
817    {
818        self.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, cipher)
819    }
820
821    // fn encrypt_str_into_array<U, const N: usize>(&mut self, iv: T, message: &str, cipher: &mut [U; N]) -> u64
822    /// Encrypts the data in a `str` object with the padding defined
823    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
824    /// and stores the encrypted data in array `[U; N]`.
825    /// 
826    /// # Arguments
827    /// - `iv` is an initialization vector for PCBC mode.
828    /// - `message` is an immutable reference to `str` object which is `&str`,
829    ///   and is the place where the plaintext to be encrypted is stored.
830    /// - `cipher` is a mutable reference to an array `[U; N]` object, and
831    ///   is the place where the encrypted data will be stored.
832    /// 
833    /// # Output
834    /// - This method returns the size of ciphertext including padding bits
835    ///   in bytes.
836    /// - The output will be at least `size_of::<T>()`,
837    ///   and cannot be other than a multiple of `size_of::<T>()`.
838    /// - If this method failed in encryption, this method returns `zero`.
839    /// 
840    /// # Features
841    /// - If `message` is a null string "", only padding bytes will be encrypted,
842    ///   and stored in the array `[U; N]` object `cipher`.
843    /// - If `U::size_in_bytes()` * `N` is less than `message.len()`'s next
844    ///   multiple of `size_of::<T>()`, this method does not perform
845    ///   encryption but returns `zero`.
846    /// - If `U::size_in_bytes()` * `N` is equal to `message.len()`'s next
847    ///   multiple of `size_of::<T>()`, this method performs encryption,
848    ///   fills the array `cipher` with the encrypted data, and returns
849    ///   the size of the ciphertext including padding bits in bytes.
850    /// - If `U::size_in_bytes()` * `N` is greater than `message.len()`'s next
851    ///   multiple of `size_of::<T>()`, this method performs encryption, fills
852    ///   the array `cipher` with the encrypted data, and then fills the
853    ///   rest of the elements of the array `cipher` with zeros, and returns
854    ///   the size of the ciphertext including padding bits in bytes.
855    /// - The size of the area for ciphertext should be prepared to be
856    ///   (`message.len()` + `1`).next_multiple_of(`size_of::<T>()`) at least.
857    ///   So, it is responsible for you to prepare the `cipher` area big enough!
858    /// - The padding bits are composed of the bytes that indicate the length of
859    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
860    /// - For more information about the padding bits according to PKCS #7,
861    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
862    /// 
863    /// # For Rijndael or AES, and its variants
864    /// ## Example 1 for AES-128
865    /// ```
866    /// use std::io::Write;
867    /// use std::fmt::Write as _;
868    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
869    /// 
870    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
871    /// println!("K =\t{:#016X}", key);
872    /// let mut a_aes = AES_128::new_with_key_u128(key);
873    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
874    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
875    /// 
876    /// let message = "In the beginning God created the heavens and the earth.";
877    /// println!("M =\t{}", message);
878    /// let mut cipher = [0_u8; 64];
879    /// a_aes.encrypt_str_into_array(iv, &message, &mut cipher);
880    /// print!("C =\t");
881    /// for c in cipher.clone()
882    ///     { print!("{:02X} ", c); }
883    /// println!();
884    /// let mut txt = String::new();
885    /// for c in cipher.clone()
886    ///     { write!(txt, "{:02X} ", c); }
887    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
888    /// ```
889    /// 
890    /// ## For more examples,
891    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_str_into_array)
892    /// 
893    /// # For DES and its variants
894    /// ## Example 1 for Normal case
895    /// ```
896    /// use std::io::Write;
897    /// use std::fmt::Write as _;
898    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
899    /// 
900    /// let key = 0x_1234567890ABCDEF_u64;
901    /// println!("K =\t{:#016X}", key);
902    /// let mut a_des = DES::new_with_key_u64(key);
903    ///
904    /// let message = "In the beginning God created the heavens and the earth.";
905    /// println!("M =\t{}", message);
906    /// let iv = 0x_FEDCBA0987654321_u64;
907    /// println!("IV =	{}", iv);
908    /// let mut cipher = [0_u8; 56];
909    /// a_des.encrypt_str_into_array(iv, &message, &mut cipher);
910    /// print!("C (16 rounds) =\t");
911    /// for c in cipher.clone()
912    ///     { print!("{:02X} ", c); }
913    /// println!();
914    /// let mut txt = String::new();
915    /// for c in cipher.clone()
916    ///     { write!(txt, "{:02X} ", c); }
917    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
918    /// ```
919    /// 
920    /// ## For more examples,
921    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_str_into_array)
922    /// 
923    /// # For BigCryptor128
924    /// ## Example 1 for TAES case
925    /// ```
926    /// use std::io::Write;
927    /// use std::fmt::Write as _;
928    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
929    /// 
930    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
931    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
932    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
933    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
934    /// println!("IV =	{:#034X}", iv);
935    /// let message = "In the beginning God created the heavens and the earth.";
936    /// let mut cipher = [0_u8; 64];
937    /// taes.encrypt_str_into_array(iv, &message, &mut cipher);
938    /// print!("C =\t");
939    /// for c in cipher.clone()
940    ///     { print!("{:02X} ", c); }
941    /// println!();
942    /// let mut txt = String::new();
943    /// for c in cipher.clone()
944    ///     { write!(txt, "{:02X} ", c); }
945    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
946    /// ```
947    /// 
948    /// ## For more examples,
949    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_str_into_array)
950    /// 
951    /// # For BigCryptor64
952    /// ## Example 1 for TDES case
953    /// ```
954    /// use std::io::Write;
955    /// use std::fmt::Write as _;
956    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
957    /// 
958    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
959    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
960    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
961    /// let iv = 0x_FEDCBA0987654321_u64;
962    /// println!("IV =	{:#018X}", iv);
963    /// let message = "In the beginning God created the heavens and the earth.";
964    /// let mut cipher = [0_u8; 56];
965    /// tdes.encrypt_str_into_array(iv, &message, &mut cipher);
966    /// print!("C =\t");
967    /// for c in cipher.clone()
968    ///     { print!("{:02X} ", c); }
969    /// println!();
970    /// let mut txt = String::new();
971    /// for c in cipher.clone()
972    ///     { write!(txt, "{:02X} ", c); }
973    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
974    /// ```
975    /// 
976    /// ## For more examples,
977    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_str_into_array)
978    #[inline]
979    fn encrypt_str_into_array<U, const N: usize>(&mut self, iv: T, message: &str, cipher: &mut [U; N]) -> u64
980    where U: SmallUInt + Copy + Clone
981    {
982        self.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, cipher)
983    }
984
985    // fn encrypt_string(&mut self, iv: T, message: &String, cipher: *mut u8) -> u64
986    /// Encrypts the data stored in a `String` object with the padding
987    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
988    /// 
989    /// # Arguments
990    /// - `iv` is an initialization vector for PCBC mode.
991    /// - `message` is an immutable reference to `String` object, and
992    ///   is the place where the plaintext to be encrypted is stored.
993    /// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
994    ///   is the place where the encrypted data will be stored.
995    /// 
996    /// # Output
997    /// - This method returns the size of ciphertext including padding bits
998    ///   in bytes.
999    /// - The output will be at least `size_of::<T>()`,
1000    ///   and cannot be other than a multiple of `size_of::<T>()`.
1001    /// - If this method failed in encryption, this method returns `zero`.
1002    /// 
1003    /// # Features
1004    /// - You are not encouraged to use this method in pure Rust programming.
1005    ///   Instead, use other safer methods such as encrypt_string_into_*().
1006    /// - This method is useful to use in hybrid programming with C/C++.
1007    /// - If `message` is a `String` object that has a null string "", only
1008    ///   padding bytes will be encrypted, and stored in the memory area that
1009    ///   starts from `cipher`.
1010    /// - The size of the memory area which starts at `cipher` is assumed to be
1011    ///   enough to store the ciphertext.
1012    /// - The size of the area for ciphertext should be prepared to be
1013    ///   (`message.len()` + `1`).next_multiple_of(`size_of::<T>()`) at least.
1014    ///   So, it is responsible for you to prepare the `cipher` area big enough!
1015    /// - The padding bits are composed of the bytes that indicate the length of
1016    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1017    /// - For more information about the padding bits according to PKCS #7,
1018    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1019    /// 
1020    /// # For Rijndael or AES, and its variants
1021    /// ## Example 1 for AES-128
1022    /// ```
1023    /// use std::io::Write;
1024    /// use std::fmt::Write as _;
1025    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1026    /// 
1027    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1028    /// println!("K =\t{:#016X}", key);
1029    /// let mut a_aes = AES_128::new_with_key_u128(key);
1030    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1031    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1032    /// 
1033    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1034    /// println!("M =\t{}", message);
1035    /// let mut cipher = [0_u8; 64];
1036    /// a_aes.encrypt_string(iv, &message, cipher.as_mut_ptr());
1037    /// print!("C =\t");
1038    /// for c in cipher.clone()
1039    ///     { print!("{:02X} ", c); }
1040    /// println!();
1041    /// let mut txt = String::new();
1042    /// for c in cipher.clone()
1043    ///     { write!(txt, "{:02X} ", c); }
1044    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1045    /// ```
1046    /// 
1047    /// ## For more examples,
1048    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_string)
1049    /// 
1050    /// # For DES and its variants
1051    /// ## Example 1 for Normal case
1052    /// ```
1053    /// use std::io::Write;
1054    /// use std::fmt::Write as _;
1055    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1056    /// 
1057    /// let key = 0x_1234567890ABCDEF_u64;
1058    /// println!("K =\t{:#016X}", key);
1059    /// let mut a_des = DES::new_with_key_u64(key);
1060    /// 
1061    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1062    /// println!("M =\t{}", message);
1063    /// let iv = 0x_FEDCBA0987654321_u64;
1064    /// println!("IV =\t{}", iv);
1065    /// let mut cipher = [0_u8; 56];
1066    /// a_des.encrypt_string(iv, &message, cipher.as_mut_ptr());
1067    /// print!("C (16 rounds) =\t");
1068    /// for c in cipher.clone()
1069    ///     { print!("{:02X} ", c); }
1070    /// println!();
1071    /// let mut txt = String::new();
1072    /// for c in cipher.clone()
1073    ///     { write!(txt, "{:02X} ", c); }
1074    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D 6C 3B A2 00 38 C3 D4 29 42 B1 CF 0D E9 FA EA 11 11 6B C8 30 73 39 DD B7 3F 96 9B A3 76 05 34 7E 64 2F D4 CC B2 68 33 64 C5 9E EF 01 A9 4A FD 5B ");
1075    /// ```
1076    /// 
1077    /// ## For more examples,
1078    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_string)
1079    /// 
1080    /// # For BigCryptor128
1081    /// ## Example 1 for TAES case
1082    /// ```
1083    /// use std::io::Write;
1084    /// use std::fmt::Write as _;
1085    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1086    /// 
1087    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1088    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1089    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1090    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1091    /// println!("IV =	{:#034X}", iv);
1092    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1093    /// let mut cipher = [0_u8; 64];
1094    /// taes.encrypt_string(iv, &message, cipher.as_mut_ptr());
1095    /// print!("C =\t");
1096    /// for c in cipher.clone()
1097    ///     { print!("{:02X} ", c); }
1098    /// println!();
1099    /// let mut txt = String::new();
1100    /// for c in cipher.clone()
1101    ///     { write!(txt, "{:02X} ", c); }
1102    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1103    /// ```
1104    /// 
1105    /// ## For more examples,
1106    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_string)
1107    /// 
1108    /// # For BigCryptor64
1109    /// ## Example 1 for TDES case
1110    /// ```
1111    /// use std::io::Write;
1112    /// use std::fmt::Write as _;
1113    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1114    /// 
1115    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1116    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1117    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1118    /// let iv = 0x_FEDCBA0987654321_u64;
1119    /// println!("IV =	{:#018X}", iv);
1120    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1121    /// let mut cipher = [0_u8; 56];
1122    /// tdes.encrypt_string(iv, &message, cipher.as_mut_ptr());
1123    /// print!("C =\t");
1124    /// for c in cipher.clone()
1125    ///     { print!("{:02X} ", c); }
1126    /// println!();
1127    /// let mut txt = String::new();
1128    /// for c in cipher.clone()
1129    ///     { write!(txt, "{:02X} ", c); }
1130    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1131    /// ```
1132    /// 
1133    /// ## For more examples,
1134    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_string)
1135    #[inline]
1136    fn encrypt_string(&mut self, iv: T, message: &String, cipher: *mut u8) -> u64
1137    {
1138        self.encrypt(iv, message.as_ptr(), message.len() as u64, cipher)
1139    }
1140
1141    // fn encrypt_string_into_vec<U>(&mut self, iv: T, message: &String, cipher: &mut Vec<U>) -> u64
1142    /// Encrypts the data stored in a `String` object with the padding
1143    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
1144    /// and stores the encrypted data in `Vec<U>`.
1145    /// 
1146    /// # Arguments
1147    /// - `iv` is an initialization vector for PCBC mode.
1148    /// - `message` is an immutable reference to `String` object, and
1149    ///   is the place where the plaintext to be encrypted is stored.
1150    /// - `cipher` is a mutable reference to `Vec<U>` object, and
1151    ///   is the place where the encrypted data will be stored.
1152    /// 
1153    /// # Output
1154    /// - This method returns the size of ciphertext including padding bits
1155    ///   in bytes.
1156    /// - The output will be at least `size_of::<T>()`,
1157    ///   and cannot be other than a multiple of `size_of::<T>()`.
1158    /// - If this method failed in encryption, this method returns `zero`.
1159    /// 
1160    /// # Features
1161    /// - If `message` is a `String` object that has a null string "", only
1162    ///   padding bytes will be encrypted, and stored in the `Vec<U>` object
1163    ///   which is referred to as `cipher`.
1164    /// - The padding bits are composed of the bytes that indicate the length of
1165    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1166    /// - For more information about the padding bits according to PKCS #7,
1167    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1168    /// - You don't have to worry about whether or not the size of the memory
1169    ///   area where the ciphertext will be stored is enough.
1170    /// 
1171    /// # For Rijndael or AES, and its variants
1172    /// ## Example 1 for AES-128
1173    /// ```
1174    /// use std::io::Write;
1175    /// use std::fmt::Write as _;
1176    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1177    /// 
1178    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1179    /// println!("K =\t{:#016X}", key);
1180    /// let mut a_aes = AES_128::new_with_key_u128(key);
1181    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1182    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1183    /// 
1184    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1185    /// println!("M =\t{}", message);
1186    /// let mut cipher = Vec::<u8>::new();
1187    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
1188    /// print!("C =\t");
1189    /// for c in cipher.clone()
1190    ///     { print!("{:02X} ", c); }
1191    /// println!();
1192    /// let mut txt = String::new();
1193    /// for c in cipher.clone()
1194    ///     { write!(txt, "{:02X} ", c); }
1195    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1196    /// ```
1197    /// 
1198    /// ## For more examples,
1199    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_string_into_vec)
1200    /// 
1201    /// # For DES and its variants
1202    /// ## Example 1 for Normal case
1203    /// ```
1204    /// use std::io::Write;
1205    /// use std::fmt::Write as _;
1206    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1207    /// 
1208    /// let key = 0x_1234567890ABCDEF_u64;
1209    /// println!("K =\t{:#016X}", key);
1210    /// let mut a_des = DES::new_with_key_u64(key);
1211    ///
1212    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1213    /// println!("M =\t{}", message);
1214    /// let iv = 0x_FEDCBA0987654321_u64;
1215    /// println!("IV =	{}", iv);
1216    /// let mut cipher = Vec::<u8>::new();
1217    /// a_des.encrypt_string_into_vec(iv, &message, &mut cipher);
1218    /// print!("C (16 rounds) =\t");
1219    /// for c in cipher.clone()
1220    ///     { print!("{:02X} ", c); }
1221    /// println!();
1222    /// let mut txt = String::new();
1223    /// for c in cipher.clone()
1224    ///     { write!(txt, "{:02X} ", c); }
1225    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
1226    /// ```
1227    /// 
1228    /// ## For more examples,
1229    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_string_into_vec)
1230    /// 
1231    /// # For BigCryptor128
1232    /// ## Example 1 for TAES case
1233    /// ```
1234    /// use std::io::Write;
1235    /// use std::fmt::Write as _;
1236    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1237    /// 
1238    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1239    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1240    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1241    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1242    /// println!("IV =	{:#034X}", iv);
1243    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1244    /// let mut cipher = Vec::<u8>::new();
1245    /// taes.encrypt_string_into_vec(iv, &message, &mut cipher);
1246    /// print!("C =\t");
1247    /// for c in cipher.clone()
1248    ///     { print!("{:02X} ", c); }
1249    /// println!();
1250    /// let mut txt = String::new();
1251    /// for c in cipher.clone()
1252    ///     { write!(txt, "{:02X} ", c); }
1253    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1254    /// ```
1255    /// 
1256    /// ## For more examples,
1257    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_string_into_vec)
1258    /// 
1259    /// # For BigCryptor64
1260    /// ## Example 1 for TDES case
1261    /// ```
1262    /// use std::io::Write;
1263    /// use std::fmt::Write as _;
1264    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1265    /// 
1266    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1267    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1268    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1269    /// let iv = 0x_FEDCBA0987654321_u64;
1270    /// println!("IV =	{:#018X}", iv);
1271    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1272    /// let mut cipher = Vec::<u8>::new();
1273    /// tdes.encrypt_string_into_vec(iv, &message, &mut cipher);
1274    /// print!("C =\t");
1275    /// for c in cipher.clone()
1276    ///     { print!("{:02X} ", c); }
1277    /// println!();
1278    /// let mut txt = String::new();
1279    /// for c in cipher.clone()
1280    ///     { write!(txt, "{:02X} ", c); }
1281    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1282    /// ```
1283    /// 
1284    /// ## For more examples,
1285    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_string_into_vec)
1286    #[inline]
1287    fn encrypt_string_into_vec<U>(&mut self, iv: T, message: &String, cipher: &mut Vec<U>) -> u64
1288    where U: SmallUInt + Copy + Clone
1289    {
1290        self.encrypt_into_vec(iv, message.as_ptr(), message.len() as u64, cipher)
1291    }
1292
1293    // fn encrypt_string_into_array<U, const N: usize>(&mut self, iv: T, message: &String, cipher: &mut [U; N]) -> u64
1294    /// Encrypts the data stored in a `String` object with the padding
1295    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
1296    /// and stores the encrypted data in array `[U; N]`.
1297    /// 
1298    /// # Arguments
1299    /// - `iv` is an initialization vector for PCBC mode.
1300    /// - `message` is an immutable reference to `String` object, and
1301    ///   is the place where the plaintext to be encrypted is stored.
1302    /// - `cipher` is a mutable reference to an array `[U; N]` object, and
1303    ///   is the place where the encrypted data will be stored.
1304    /// 
1305    /// # Output
1306    /// - This method returns the size of ciphertext including padding bits
1307    ///   in bytes.
1308    /// - The output will be at least `size_of::<T>()`,
1309    ///   and cannot be other than a multiple of `size_of::<T>()`.
1310    /// - If this method failed in encryption, this method returns `zero`.
1311    /// 
1312    /// # Features
1313    /// - If `message` is a `String` object that has a null string "", only
1314    ///   padding bytes will be encrypted, and stored in the array `[U; N]`
1315    ///   object `cipher`.
1316    /// - If `size_of::<U>()` * `N` is less than `message.len()`'s next
1317    ///   multiple of `size_of::<T>()`, this method does not perform
1318    ///   encryption but returns `zero`.
1319    /// - If `size_of::<U>()` * `N` is equal to `message.len()`'s next
1320    ///   multiple of `size_of::<T>()`, this method performs encryption,
1321    ///   fills the array `cipher` with the encrypted data, and returns
1322    ///   the size of the ciphertext including padding bits in bytes.
1323    /// - If `size_of::<U>()` * `N` is greater than `message.len()`'s next
1324    ///   multiple of `size_of::<T>()`, this method performs encryption, fills
1325    ///   the array `cipher` with the encrypted data, and then fills the
1326    ///   rest of the elements of the array `cipher` with zeros, and returns
1327    ///   the size of the ciphertext including padding bits in bytes.
1328    /// - The size of the area for ciphertext should be prepared to be
1329    ///   (`message.len()` + `1`).next_multiple_of(`size_of::<T>()`) at least.
1330    ///   So, it is responsible for you to prepare the `cipher` area big enough!
1331    /// - The padding bits are composed of the bytes that indicate the length of
1332    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1333    /// - For more information about the padding bits according to PKCS #7,
1334    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1335    /// 
1336    /// # For Rijndael or AES, and its variants
1337    /// ## Example 1 for AES-128
1338    /// ```
1339    /// use std::io::Write;
1340    /// use std::fmt::Write as _;
1341    /// use cryptocol::symmetric::{ AES_128, AES_192, AES_256, Rijndael_256_256, Rijndael_512_512, PCBC_PKCS7 };
1342    /// 
1343    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1344    /// println!("K =\t{:#016X}", key);
1345    /// let mut a_aes = AES_128::new_with_key_u128(key);
1346    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1347    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1348    /// 
1349    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1350    /// println!("M =\t{}", message);
1351    /// let mut cipher = [0_u8; 64];
1352    /// a_aes.encrypt_str_into_array(iv, &message, &mut cipher);
1353    /// print!("C =\t");
1354    /// for c in cipher.clone()
1355    ///     { print!("{:02X} ", c); }
1356    /// println!();
1357    /// let mut txt = String::new();
1358    /// for c in cipher.clone()
1359    ///     { write!(txt, "{:02X} ", c); }
1360    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1361    /// ```
1362    /// 
1363    /// ## For more examples,
1364    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_string_into_array)
1365    /// 
1366    /// # For DES and its variants
1367    /// ## Example 1 for Normal case
1368    /// ```
1369    /// use std::io::Write;
1370    /// use std::fmt::Write as _;
1371    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1372    /// 
1373    /// let key = 0x_1234567890ABCDEF_u64;
1374    /// println!("K =\t{:#016X}", key);
1375    /// let mut a_des = DES::new_with_key_u64(key);
1376    ///
1377    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1378    /// println!("M =\t{}", message);
1379    /// let iv = 0x_FEDCBA0987654321_u64;
1380    /// println!("IV =	{}", iv);
1381    /// let mut cipher = [0_u8; 56];
1382    /// a_des.encrypt_string_into_array(iv, &message, &mut cipher);
1383    /// print!("C (16 rounds) =\t");
1384    /// for c in cipher.clone()
1385    ///     { print!("{:02X} ", c); }
1386    /// println!();
1387    /// let mut txt = String::new();
1388    /// for c in cipher.clone()
1389    ///     { write!(txt, "{:02X} ", c); }
1390    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
1391    /// ```
1392    /// 
1393    /// ## For more examples,
1394    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_string_into_array)
1395    /// 
1396    /// # For BigCryptor128
1397    /// ## Example 1 for TAES case
1398    /// ```
1399    /// use std::io::Write;
1400    /// use std::fmt::Write as _;
1401    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1402    /// 
1403    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1404    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1405    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1406    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1407    /// println!("IV =	{:#034X}", iv);
1408    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1409    /// let mut cipher = [0_u8; 64];
1410    /// taes.encrypt_string_into_array(iv, &message, &mut cipher);
1411    /// print!("C =\t");
1412    /// for c in cipher.clone()
1413    ///     { print!("{:02X} ", c); }
1414    /// println!();
1415    /// let mut txt = String::new();
1416    /// for c in cipher.clone()
1417    ///     { write!(txt, "{:02X} ", c); }
1418    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1419    /// ```
1420    /// 
1421    /// ## For more examples,
1422    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_string_into_array)
1423    /// 
1424    /// # For BigCryptor64
1425    /// ## Example 1 for TDES case
1426    /// ```
1427    /// use std::io::Write;
1428    /// use std::fmt::Write as _;
1429    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1430    /// 
1431    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1432    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1433    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1434    /// let iv = 0x_FEDCBA0987654321_u64;
1435    /// println!("IV =	{:#018X}", iv);
1436    /// let message = "In the beginning God created the heavens and the earth.".to_string();
1437    /// let mut cipher = [0_u8; 56];
1438    /// tdes.encrypt_string_into_array(iv, &message, &mut cipher);
1439    /// print!("C =\t");
1440    /// for c in cipher.clone()
1441    ///     { print!("{:02X} ", c); }
1442    /// println!();
1443    /// let mut txt = String::new();
1444    /// for c in cipher.clone()
1445    ///     { write!(txt, "{:02X} ", c); }
1446    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1447    /// ```
1448    /// 
1449    /// ## For more examples,
1450    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_string_into_array)
1451    #[inline]
1452    fn encrypt_string_into_array<U, const N: usize>(&mut self, iv: T, message: &String, cipher: &mut [U; N]) -> u64
1453    where U: SmallUInt + Copy + Clone
1454    {
1455        self.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, cipher)
1456    }
1457
1458    // fn encrypt_vec<U>(&mut self, iv: T, message: &Vec<U>, cipher: *mut u8) -> u64
1459    /// Encrypts the data stored in a `Vec<U>` object with the padding defined
1460    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
1461    /// 
1462    /// # Arguments
1463    /// - `iv` is an initialization vector for PCBC mode.
1464    /// - `message` is an immutable reference to `Vec<U>` object, and
1465    ///   is the place where the plaintext to be encrypted is stored.
1466    /// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
1467    ///   is the place where the encrypted data will be stored.
1468    /// 
1469    /// # Output
1470    /// - This method returns the size of ciphertext including padding bits
1471    ///   in bytes.
1472    /// - The output will be at least `size_of::<T>()`,
1473    ///   and cannot be other than a multiple of `size_of::<T>()`.
1474    /// - If this method failed in encryption, this method returns `zero`.
1475    /// 
1476    /// # Features
1477    /// - You are not encouraged to use this method in pure Rust programming.
1478    ///   Instead, use other safer methods such as encrypt_vec_into_*().
1479    /// - This method is useful to use in hybrid programming with C/C++.
1480    /// - The size of the memory area which starts at `cipher` is assumed to be
1481    ///   enough to store the ciphertext.
1482    /// - The size of the area for ciphertext should be prepared to be
1483    ///   (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`size_of::<T>()`)
1484    ///   at least.
1485    ///   So, it is responsible for you to prepare the `cipher` area big enough!
1486    /// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
1487    ///   padding bytes will be encrypted, and stored in the memory area that
1488    ///   starts from `cipher`.
1489    /// - The padding bits are composed of the bytes that indicate the length of
1490    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1491    /// - For more information about the padding bits according to PKCS #7,
1492    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1493    /// 
1494    /// # For Rijndael or AES, and its variants
1495    /// ## Example 1 for AES-128
1496    /// ```
1497    /// use std::io::Write;
1498    /// use std::fmt::Write as _;
1499    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1500    /// 
1501    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1502    /// println!("K =\t{:#016X}", key);
1503    /// let mut a_aes = AES_128::new_with_key_u128(key);
1504    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1505    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1506    /// 
1507    /// let message = "In the beginning God created the heavens and the earth.";
1508    /// println!("M =\t{}", message);
1509    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1510    /// let mut cipher = [0_u8; 64];
1511    /// a_aes.encrypt_vec(iv, &message, cipher.as_mut_ptr());
1512    /// print!("C =\t");
1513    /// for c in cipher.clone()
1514    ///     { print!("{:02X} ", c); }
1515    /// println!();
1516    /// let mut txt = String::new();
1517    /// for c in cipher.clone()
1518    ///     { write!(txt, "{:02X} ", c); }
1519    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1520    /// ```
1521    /// 
1522    /// ## For more examples,
1523    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_vec)
1524    /// 
1525    /// # For DES and its variants
1526    /// ## Example 1 for Normal case
1527    /// ```
1528    /// use std::io::Write;
1529    /// use std::fmt::Write as _;
1530    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1531    /// 
1532    /// let key = 0x_1234567890ABCDEF_u64;
1533    /// println!("K =\t{:#016X}", key);
1534    /// let mut a_des = DES::new_with_key_u64(key);
1535    ///
1536    /// let message = "In the beginning God created the heavens and the earth.";
1537    /// println!("M =\t{}", message);
1538    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1539    /// let iv = 0x_FEDCBA0987654321_u64;
1540    /// println!("IV =	{}", iv);
1541    /// let mut cipher = [0_u8; 56];
1542    /// a_des.encrypt_vec(iv, &message, cipher.as_mut_ptr());
1543    /// print!("C (16 rounds) =\t");
1544    /// for c in cipher.clone()
1545    ///     { print!("{:02X} ", c); }
1546    /// println!();
1547    /// let mut txt = String::new();
1548    /// for c in cipher.clone()
1549    ///     { write!(txt, "{:02X} ", c); }
1550    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
1551    /// ```
1552    /// 
1553    /// ## For more examples,
1554    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_vec)
1555    /// 
1556    /// # For BigCryptor128
1557    /// ## Example 1 for TAES case
1558    /// ```
1559    /// use std::io::Write;
1560    /// use std::fmt::Write as _;
1561    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1562    /// 
1563    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1564    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1565    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1566    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1567    /// println!("IV =	{:#034X}", iv);
1568    /// let message = "In the beginning God created the heavens and the earth.";
1569    /// println!("M =\t{}", message);
1570    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1571    /// let mut cipher = [0_u8; 64];
1572    /// taes.encrypt_vec(iv, &message, cipher.as_mut_ptr());
1573    /// print!("C =\t");
1574    /// for c in cipher.clone()
1575    ///     { print!("{:02X} ", c); }
1576    /// println!();
1577    /// let mut txt = String::new();
1578    /// for c in cipher.clone()
1579    ///     { write!(txt, "{:02X} ", c); }
1580    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1581    /// ```
1582    /// 
1583    /// ## For more examples,
1584    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_vec)
1585    /// 
1586    /// # For BigCryptor64
1587    /// ## Example 1 for TDES case
1588    /// ```
1589    /// use std::io::Write;
1590    /// use std::fmt::Write as _;
1591    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1592    /// 
1593    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1594    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1595    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1596    /// let iv = 0x_FEDCBA0987654321_u64;
1597    /// println!("IV =	{:#018X}", iv);
1598    /// let message = "In the beginning God created the heavens and the earth.";
1599    /// println!("M =\t{}", message);
1600    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1601    /// let mut cipher = [0_u8; 56];
1602    /// tdes.encrypt_vec(iv, &message, cipher.as_mut_ptr());
1603    /// print!("C =\t");
1604    /// for c in cipher.clone()
1605    ///     { print!("{:02X} ", c); }
1606    /// println!();
1607    /// let mut txt = String::new();
1608    /// for c in cipher.clone()
1609    ///     { write!(txt, "{:02X} ", c); }
1610    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1611    /// ```
1612    /// 
1613    /// ## For more examples,
1614    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_vec)
1615    #[inline]
1616    fn encrypt_vec<U>(&mut self, iv: T, message: &Vec<U>, cipher: *mut u8) -> u64
1617    where U: SmallUInt + Copy + Clone
1618    {
1619        self.encrypt(iv, message.as_ptr() as *const u8, (message.len() as u32 * U::size_in_bytes()) as u64, cipher)
1620    }
1621
1622    // fn encrypt_vec_into_vec<U, V>(&mut self, iv: T, message: &Vec<U>, cipher: &mut Vec<V>) -> u64
1623    /// Encrypts the data stored in a `Vec<U>` object with the padding defined
1624    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and
1625    /// stores the encrypted data in `Vec<V>`.
1626    /// 
1627    /// # Arguments
1628    /// - `iv` is an initialization vector for PCBC mode.
1629    /// - `message` is an immutable reference to `Vec<U>` object, and
1630    ///   is the place where the plaintext to be encrypted is stored.
1631    /// - `cipher` is a mutable reference to `Vec<U>` object, and
1632    ///   is the place where the encrypted data will be stored.
1633    /// 
1634    /// # Output
1635    /// - This method returns the size of ciphertext including padding bits
1636    ///   in bytes.
1637    /// - The output will be at least `size_of::<T>()`,
1638    ///   and cannot be other than a multiple of `size_of::<T>()`.
1639    /// - If this method failed in encryption, this method returns `zero`.
1640    /// 
1641    /// # Features
1642    /// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
1643    ///   padding bytes will be encrypted, and stored in the `Vec<U>` object
1644    ///   which is referred to as `cipher`.
1645    /// - The padding bits are composed of the bytes that indicate the length of
1646    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1647    /// - For more information about the padding bits according to PKCS #7,
1648    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1649    /// - You don't have to worry about whether or not the size of the memory
1650    ///   area where the ciphertext will be stored is enough.
1651    /// 
1652    /// # For Rijndael or AES, and its variants
1653    /// ## Example 1 for AES-128
1654    /// ```
1655    /// use std::io::Write;
1656    /// use std::fmt::Write as _;
1657    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1658    /// 
1659    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1660    /// println!("K =\t{:#016X}", key);
1661    /// let mut a_aes = AES_128::new_with_key_u128(key);
1662    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1663    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1664    /// 
1665    /// let message = "In the beginning God created the heavens and the earth.";
1666    /// println!("M =\t{}", message);
1667    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1668    /// let mut cipher = Vec::<u8>::new();
1669    /// a_aes.encrypt_vec_into_vec(iv, &message, &mut cipher);
1670    /// print!("C =\t");
1671    /// for c in cipher.clone()
1672    ///     { print!("{:02X} ", c); }
1673    /// println!();
1674    /// let mut txt = String::new();
1675    /// for c in cipher.clone()
1676    ///     { write!(txt, "{:02X} ", c); }
1677    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1678    /// ```
1679    /// 
1680    /// ## For more examples,
1681    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_vec_into_vec)
1682    /// 
1683    /// # For DES and its variants
1684    /// ## Example 1 for Normal case
1685    /// ```
1686    /// use std::io::Write;
1687    /// use std::fmt::Write as _;
1688    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1689    /// 
1690    /// let key = 0x_1234567890ABCDEF_u64;
1691    /// println!("K =\t{:#016X}", key);
1692    /// let mut a_des = DES::new_with_key_u64(key);
1693    /// 
1694    /// let message = "In the beginning God created the heavens and the earth.";
1695    /// println!("M =\t{}", message);
1696    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1697    /// let iv = 0x_FEDCBA0987654321_u64;
1698    /// println!("IV =\t{}", iv);
1699    /// let mut cipher = Vec::<u8>::new();
1700    /// a_des.encrypt_vec_into_vec(iv, &message, &mut cipher);
1701    /// print!("C (16 rounds) =\t");
1702    /// for c in cipher.clone()
1703    ///     { print!("{:02X} ", c); }
1704    /// println!();
1705    /// let mut txt = String::new();
1706    /// for c in cipher.clone()
1707    ///     { write!(txt, "{:02X} ", c); }
1708    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D 6C 3B A2 00 38 C3 D4 29 42 B1 CF 0D E9 FA EA 11 11 6B C8 30 73 39 DD B7 3F 96 9B A3 76 05 34 7E 64 2F D4 CC B2 68 33 64 C5 9E EF 01 A9 4A FD 5B ");
1709    /// ```
1710    /// 
1711    /// ## For more examples,
1712    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_vec_into_vec)
1713    /// 
1714    /// # For BigCryptor128
1715    /// ## Example 1 for TAES case
1716    /// ```
1717    /// use std::io::Write;
1718    /// use std::fmt::Write as _;
1719    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1720    /// 
1721    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1722    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1723    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1724    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1725    /// println!("IV =	{:#034X}", iv);
1726    /// let message = "In the beginning God created the heavens and the earth.";
1727    /// println!("M =\t{}", message);
1728    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1729    /// let mut cipher = Vec::<u8>::new();
1730    /// taes.encrypt_vec_into_vec(iv, &message, &mut cipher);
1731    /// print!("C =\t");
1732    /// for c in cipher.clone()
1733    ///     { print!("{:02X} ", c); }
1734    /// println!();
1735    /// let mut txt = String::new();
1736    /// for c in cipher.clone()
1737    ///     { write!(txt, "{:02X} ", c); }
1738    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1739    /// ```
1740    /// 
1741    /// ## For more examples,
1742    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_vec_into_vec)
1743    /// 
1744    /// # For BigCryptor64
1745    /// ## Example 1 for TDES case
1746    /// ```
1747    /// use std::io::Write;
1748    /// use std::fmt::Write as _;
1749    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1750    /// 
1751    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1752    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1753    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1754    /// let iv = 0x_FEDCBA0987654321_u64;
1755    /// println!("IV =	{:#018X}", iv);
1756    /// let message = "In the beginning God created the heavens and the earth.";
1757    /// println!("M =\t{}", message);
1758    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1759    /// let mut cipher = Vec::<u8>::new();
1760    /// tdes.encrypt_vec_into_vec(iv, &message, &mut cipher);
1761    /// print!("C =\t");
1762    /// for c in cipher.clone()
1763    ///     { print!("{:02X} ", c); }
1764    /// println!();
1765    /// let mut txt = String::new();
1766    /// for c in cipher.clone()
1767    ///     { write!(txt, "{:02X} ", c); }
1768    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1769    /// ```
1770    /// 
1771    /// ## For more examples,
1772    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_vec_into_vec)
1773    #[inline]
1774    fn encrypt_vec_into_vec<U, V>(&mut self, iv: T, message: &Vec<U>, cipher: &mut Vec<V>) -> u64
1775    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
1776    {
1777        self.encrypt_into_vec(iv, message.as_ptr() as *const u8, (message.len() as u32 * U::size_in_bytes()) as u64, cipher)
1778    }
1779
1780    // fn encrypt_vec_into_array<U, V, const N: usize>(&mut self, iv: T, message: &Vec<U>, cipher: &mut [V; N]) -> u64
1781    /// Encrypts the data stored in a `Vec<U>` object with the padding defined
1782    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and
1783    /// stores the encrypted data in array `[V; N]`.
1784    /// 
1785    /// # Arguments
1786    /// - `iv` is an initialization vector for PCBC mode.
1787    /// - `message` is an immutable reference to `Vec<U>` object, and
1788    ///   is the place where the plaintext to be encrypted is stored.
1789    /// - `cipher` is a mutable reference to an array `[U; N]` object, and
1790    ///   is the place where the encrypted data will be stored.
1791    /// 
1792    /// # Output
1793    /// - This method returns the size of ciphertext including padding bits
1794    ///   in bytes.
1795    /// - The output will be at least `size_of::<T>()`,
1796    ///   and cannot be other than a multiple of `size_of::<T>()`.
1797    /// - If this method failed in encryption, this method returns `zero`.
1798    /// 
1799    /// # Features
1800    /// - If `message` is an empty `Vec<U>` object `Vec::<U>::new()`, only
1801    ///   padding bytes will be encrypted, and stored in the array `[U; N]`
1802    ///   object `cipher`.
1803    /// - If `size_of::<V>()` * `N` is less than 
1804    ///   `size_of::<U>() * message.len()`'s next multiple of
1805    ///   `size_of::<T>()`, this method does not perform
1806    ///   encryption but returns `zero`.
1807    /// - If `size_of::<V>()` * `N` is equal to
1808    ///   `size_of::<U>() * message.len()`'s next multiple of
1809    ///   `size_of::<T>()`, this method performs encryption,
1810    ///   fills the array `cipher` with the encrypted data, and returns
1811    ///   the size of the ciphertext including padding bits in bytes.
1812    /// - If `size_of::<V>()` * `N` is greater than
1813    ///   `size_of::<U>() * message.len()`'s next multiple of `size_of::<T>()`,
1814    ///   this method performs encryption, fills the array `cipher` with the
1815    ///   encrypted data, and then fills the rest of the elements of the array
1816    ///   `cipher` with zeros, and returns the size of the ciphertext including
1817    ///   padding bits in bytes.
1818    /// - The size of the area for ciphertext should be prepared to be
1819    ///   (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`size_of::<T>()`)
1820    ///   at least.
1821    ///   So, it is responsible for you to prepare the `cipher` area big enough!
1822    /// - The padding bits are composed of the bytes that indicate the length of
1823    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1824    /// - For more information about the padding bits according to PKCS#7,
1825    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1826    /// 
1827    /// # For Rijndael or AES, and its variants
1828    /// ## Example 1 for AES-128
1829    /// ```
1830    /// use std::io::Write;
1831    /// use std::fmt::Write as _;
1832    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1833    /// 
1834    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1835    /// println!("K =\t{:#016X}", key);
1836    /// let mut a_aes = AES_128::new_with_key_u128(key);
1837    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
1838    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
1839    /// 
1840    /// let message = "In the beginning God created the heavens and the earth.";
1841    /// println!("M =\t{}", message);
1842    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1843    /// let mut cipher = [0_u8; 64];
1844    /// a_aes.encrypt_vec_into_array(iv, &message, &mut cipher);
1845    /// print!("C =\t");
1846    /// for c in cipher.clone()
1847    ///     { print!("{:02X} ", c); }
1848    /// println!();
1849    /// let mut txt = String::new();
1850    /// for c in cipher.clone()
1851    ///     { write!(txt, "{:02X} ", c); }
1852    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
1853    /// ```
1854    /// 
1855    /// ## For more examples,
1856    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_vec_into_array)
1857    /// 
1858    /// # For DES and its variants
1859    /// ## Example 1 for Normal case
1860    /// ```
1861    /// use std::io::Write;
1862    /// use std::fmt::Write as _;
1863    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
1864    /// 
1865    /// let key = 0x_1234567890ABCDEF_u64;
1866    /// println!("K =\t{:#016X}", key);
1867    /// let mut a_des = DES::new_with_key_u64(key);
1868    ///
1869    /// let message = "In the beginning God created the heavens and the earth.";
1870    /// println!("M =\t{}", message);
1871    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1872    /// let iv = 0x_FEDCBA0987654321_u64;
1873    /// println!("IV =	{}", iv);
1874    /// let mut cipher = [0_u8; 56];
1875    /// a_des.encrypt_vec_into_array(iv, &message, &mut cipher);
1876    /// print!("C (16 rounds) =\t");
1877    /// for c in cipher.clone()
1878    ///     { print!("{:02X} ", c); }
1879    /// println!();
1880    /// let mut txt = String::new();
1881    /// for c in cipher.clone()
1882    ///     { write!(txt, "{:02X} ", c); }
1883    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
1884    /// ```
1885    /// 
1886    /// ## For more examples,
1887    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_vec_into_array)
1888    /// 
1889    /// # For BigCryptor128
1890    /// ## Example 1 for TAES case
1891    /// ```
1892    /// use std::io::Write;
1893    /// use std::fmt::Write as _;
1894    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
1895    /// 
1896    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
1897    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
1898    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
1899    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
1900    /// println!("IV =	{:#034X}", iv);
1901    /// let message = "In the beginning God created the heavens and the earth.";
1902    /// println!("M =\t{}", message);
1903    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1904    /// let mut cipher = [0_u8; 64];
1905    /// taes.encrypt_vec_into_array(iv, &message, &mut cipher);
1906    /// print!("C =\t");
1907    /// for c in cipher.clone()
1908    ///     { print!("{:02X} ", c); }
1909    /// println!();
1910    /// let mut txt = String::new();
1911    /// for c in cipher.clone()
1912    ///     { write!(txt, "{:02X} ", c); }
1913    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
1914    /// ```
1915    /// 
1916    /// ## For more examples,
1917    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_vec_into_array)
1918    /// 
1919    /// # For BigCryptor64
1920    /// ## Example 1 for TDES case
1921    /// ```
1922    /// use std::io::Write;
1923    /// use std::fmt::Write as _;
1924    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
1925    /// 
1926    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
1927    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
1928    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
1929    /// let iv = 0x_FEDCBA0987654321_u64;
1930    /// println!("IV =	{:#018X}", iv);
1931    /// let message = "In the beginning God created the heavens and the earth.";
1932    /// println!("M =\t{}", message);
1933    /// let message = unsafe { message.to_string().as_mut_vec().clone() };
1934    /// let mut cipher = [0_u8; 56];
1935    /// tdes.encrypt_vec_into_array(iv, &message, &mut cipher);
1936    /// print!("C =\t");
1937    /// for c in cipher.clone()
1938    ///     { print!("{:02X} ", c); }
1939    /// println!();
1940    /// let mut txt = String::new();
1941    /// for c in cipher.clone()
1942    ///     { write!(txt, "{:02X} ", c); }
1943    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
1944    /// ```
1945    /// 
1946    /// ## For more examples,
1947    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_vec_into_array)
1948    #[inline]
1949    fn encrypt_vec_into_array<U, V, const N: usize>(&mut self, iv: T, message: &Vec<U>, cipher: &mut [V; N]) -> u64
1950    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
1951    {
1952        self.encrypt_into_array(iv, message.as_ptr() as *const u8, (message.len() as u32 * U::size_in_bytes()) as u64, cipher)
1953    }
1954
1955    // fn encrypt_array<U, const N: usize>(&mut self, iv: T, message: &[U; N], cipher: *mut u8) -> u64
1956    /// Encrypts the data stored in an array `[U; N]` object with the padding
1957    /// defined according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
1958    /// 
1959    /// # Arguments
1960    /// - `iv` is an initialization vector for PCBC mode.
1961    /// - `message` is an immutable reference to an array `[U; N]` object, and
1962    ///   is the place where the plaintext to be encrypted is stored.
1963    /// - `cipher` is a mutable pointer to `u8` which is `*mut u8`, and
1964    ///   is the place where the encrypted data will be stored.
1965    /// 
1966    /// # Output
1967    /// - This method returns the size of ciphertext including padding bits
1968    ///   in bytes.
1969    /// - The output will be at least `size_of::<T>()`,
1970    ///   and cannot be other than a multiple of `size_of::<T>()`.
1971    /// - If this method failed in encryption, this method returns `zero`.
1972    /// 
1973    /// # Features
1974    /// - You are not encouraged to use this method in pure Rust programming.
1975    ///   Instead, use other safer methods such as encrypt_vec_into_*().
1976    /// - This method is useful to use in hybrid programming with C/C++.
1977    /// - The size of the memory area which starts at `cipher` is assumed to be
1978    ///   enough to store the ciphertext.
1979    /// - The size of the area for ciphertext should be prepared to be
1980    ///   (`size_of::<U>()` * `N` + `1`).next_multiple_of(`size_of::<T>()`)
1981    ///   at least.
1982    ///   So, it is responsible for you to prepare the `cipher` area big enough!
1983    /// - If `message` is an empty array `[U; 0]` object, only padding bytes
1984    ///   will be encrypted, and stored in the memory area that starts from `cipher`.
1985    /// - The padding bits are composed of the bytes that indicate the length of
1986    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
1987    /// - For more information about the padding bits according to PKCS #7,
1988    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
1989    /// 
1990    /// # For Rijndael or AES, and its variants
1991    /// ## Example 1 for AES-128
1992    /// ```
1993    /// use std::io::Write;
1994    /// use std::fmt::Write as _;
1995    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
1996    /// 
1997    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
1998    /// println!("K =\t{:#016X}", key);
1999    /// let mut a_aes = AES_128::new_with_key_u128(key);
2000    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2001    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2002    /// 
2003    /// let mes = "In the beginning God created the heavens and the earth.";
2004    /// println!("M =\t{}", mes);
2005    /// let mut message = [0_u8; 55];
2006    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2007    /// let mut cipher = [0_u8; 64];
2008    /// a_aes.encrypt(iv, message.as_ptr(), message.len() as u64, cipher.as_mut_ptr());
2009    /// print!("C =\t");
2010    /// for c in cipher.clone()
2011    ///     { print!("{:02X} ", c); }
2012    /// println!();
2013    /// let mut txt = String::new();
2014    /// for c in cipher.clone()
2015    ///     { write!(txt, "{:02X} ", c); }
2016    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2017    /// ```
2018    /// 
2019    /// ## For more examples,
2020    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_array)
2021    /// 
2022    /// # For DES and its variants
2023    /// ## Example 1 for Normal case
2024    /// ```
2025    /// use std::io::Write;
2026    /// use std::fmt::Write as _;
2027    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
2028    /// 
2029    /// let key = 0x_1234567890ABCDEF_u64;
2030    /// println!("K =\t{:#016X}", key);
2031    /// let mut a_des = DES::new_with_key_u64(key);
2032    ///
2033    /// let mes = "In the beginning God created the heavens and the earth.";
2034    /// println!("M =\t{}", mes);
2035    /// let mut message = [0_u8; 55];
2036    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2037    /// let iv = 0x_FEDCBA0987654321_u64;
2038    /// println!("IV =	{}", iv);
2039    /// let mut cipher = [0_u8; 56];
2040    /// a_des.encrypt_array(iv, &message, cipher.as_mut_ptr());
2041    /// print!("C (16 rounds) =\t");
2042    /// for c in cipher.clone()
2043    ///     { print!("{:02X} ", c); }
2044    /// println!();
2045    /// let mut txt = String::new();
2046    /// for c in cipher.clone()
2047    ///     { write!(txt, "{:02X} ", c); }
2048    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
2049    /// ```
2050    /// 
2051    /// ## For more examples,
2052    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_array)
2053    /// 
2054    /// # For BigCryptor128
2055    /// ## Example 1 for TAES case
2056    /// ```
2057    /// use std::io::Write;
2058    /// use std::fmt::Write as _;
2059    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
2060    /// 
2061    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
2062    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
2063    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
2064    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
2065    /// println!("IV =	{:#034X}", iv);
2066    /// let mes = "In the beginning God created the heavens and the earth.";
2067    /// println!("M =\t{}", mes);
2068    /// let mut message = [0_u8; 55];
2069    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2070    /// let mut cipher = [0_u8; 64];
2071    /// taes.encrypt_array(iv, &message, cipher.as_mut_ptr());
2072    /// print!("C =\t");
2073    /// for c in cipher.clone()
2074    ///     { print!("{:02X} ", c); }
2075    /// println!();
2076    /// let mut txt = String::new();
2077    /// for c in cipher.clone()
2078    ///     { write!(txt, "{:02X} ", c); }
2079    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
2080    /// ```
2081    /// 
2082    /// ## For more examples,
2083    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_array)
2084    /// 
2085    /// # For BigCryptor64
2086    /// ## Example 1 for TDES case
2087    /// ```
2088    /// use std::io::Write;
2089    /// use std::fmt::Write as _;
2090    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
2091    /// 
2092    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
2093    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
2094    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
2095    /// let iv = 0x_FEDCBA0987654321_u64;
2096    /// println!("IV =	{:#018X}", iv);
2097    /// let mes = "In the beginning God created the heavens and the earth.";
2098    /// println!("M =\t{}", mes);
2099    /// let mut message = [0_u8; 55];
2100    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2101    /// let mut cipher = [0_u8; 56];
2102    /// tdes.encrypt_array(iv, &message, cipher.as_mut_ptr());
2103    /// print!("C =\t");
2104    /// for c in cipher.clone()
2105    ///     { print!("{:02X} ", c); }
2106    /// println!();
2107    /// let mut txt = String::new();
2108    /// for c in cipher.clone()
2109    ///     { write!(txt, "{:02X} ", c); }
2110    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
2111    /// ```
2112    /// 
2113    /// ## For more examples,
2114    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_array)
2115    #[inline]
2116    fn encrypt_array<U, const N: usize>(&mut self, iv: T, message: &[U; N], cipher: *mut u8) -> u64
2117    where U: SmallUInt + Copy + Clone
2118    {
2119        self.encrypt(iv, message.as_ptr() as *const u8, (N as u32 * U::size_in_bytes()) as u64, cipher)
2120    }
2121
2122    // fn encrypt_array_into_vec<U, V, const N: usize>(&mut self, iv: T, message: &[U; N], cipher: &mut Vec<V>) -> u64
2123    /// Encrypts the data stored in an array `[U; N]` object with the padding
2124    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and stores the
2125    /// encrypted data in `Vec<V>`.
2126    /// 
2127    /// # Arguments
2128    /// - `iv` is an initialization vector for PCBC mode.
2129    /// - `message` is an immutable reference to an array `[U; N]` object, and
2130    ///   is the place where the plaintext to be encrypted is stored.
2131    /// - `cipher` is a mutable reference to `Vec<U>` object, and
2132    ///   is the place where the encrypted data will be stored.
2133    /// 
2134    /// # Output
2135    /// - This method returns the size of ciphertext including padding bits
2136    ///   in bytes.
2137    /// - The output will be at least `size_of::<T>()`,
2138    ///   and cannot be other than a multiple of `size_of::<T>()`.
2139    /// - If this method failed in encryption, this method returns `zero`.
2140    /// 
2141    /// # Features
2142    /// - If `message` is an empty array `[U; 0]` object, only padding bytes
2143    ///   will be encrypted, and stored in the `Vec<U>` object `cipher`.
2144    /// - The padding bits are composed of the bytes that indicate the length of
2145    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
2146    /// - For more information about the padding bits according to PKCS #7,
2147    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
2148    /// - You don't have to worry about whether or not the size of the memory
2149    ///   area where the ciphertext will be stored is enough.
2150    /// 
2151    /// # For Rijndael or AES, and its variants
2152    /// ## Example 1 for AES-128
2153    /// ```
2154    /// use std::io::Write;
2155    /// use std::fmt::Write as _;
2156    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
2157    /// 
2158    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
2159    /// println!("K =\t{:#016X}", key);
2160    /// let mut a_aes = AES_128::new_with_key_u128(key);
2161    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2162    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2163    /// 
2164    /// let mes = "In the beginning God created the heavens and the earth.";
2165    /// println!("M =\t{}", mes);
2166    /// let mut message = [0_u8; 55];
2167    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2168    /// let mut cipher = Vec::<u8>::new();
2169    /// a_aes.encrypt_array_into_vec(iv, &message, &mut cipher);
2170    /// print!("C =\t");
2171    /// for c in cipher.clone()
2172    ///     { print!("{:02X} ", c); }
2173    /// println!();
2174    /// let mut txt = String::new();
2175    /// for c in cipher.clone()
2176    ///     { write!(txt, "{:02X} ", c); }
2177    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2178    /// ```
2179    /// 
2180    /// ## For more examples,
2181    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_array_into_vec)
2182    /// 
2183    /// # For DES and its variants
2184    /// ## Example 1 for Normal case
2185    /// ```
2186    /// use std::io::Write;
2187    /// use std::fmt::Write as _;
2188    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
2189    /// 
2190    /// let key = 0x_1234567890ABCDEF_u64;
2191    /// println!("K =\t{:#016X}", key);
2192    /// let mut a_des = DES::new_with_key_u64(key);
2193    ///
2194    /// let mes = "In the beginning God created the heavens and the earth.";
2195    /// println!("M =\t{}", mes);
2196    /// let mut message = [0_u8; 55];
2197    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2198    /// let iv = 0x_FEDCBA0987654321_u64;
2199    /// println!("IV =	{}", iv);
2200    /// let mut cipher = Vec::<u8>::new();
2201    /// a_des.encrypt_array_into_vec(iv, &message, &mut cipher);
2202    /// print!("C (16 rounds) =\t");
2203    /// for c in cipher.clone()
2204    ///     { print!("{:02X} ", c); }
2205    /// println!();
2206    /// let mut txt = String::new();
2207    /// for c in cipher.clone()
2208    ///     { write!(txt, "{:02X} ", c); }
2209    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
2210    /// ```
2211    /// 
2212    /// ## For more examples,
2213    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_array_into_vec)
2214    /// 
2215    /// # For BigCryptor128
2216    /// ## Example 1 for TAES case
2217    /// ```
2218    /// use std::io::Write;
2219    /// use std::fmt::Write as _;
2220    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
2221    /// 
2222    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
2223    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
2224    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
2225    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
2226    /// println!("IV =	{:#034X}", iv);
2227    /// let mes = "In the beginning God created the heavens and the earth.";
2228    /// println!("M =\t{}", mes);
2229    /// let mut message = [0_u8; 55];
2230    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2231    /// let mut cipher = Vec::<u8>::new();
2232    /// taes.encrypt_array_into_vec(iv, &message, &mut cipher);
2233    /// print!("C =\t");
2234    /// for c in cipher.clone()
2235    ///     { print!("{:02X} ", c); }
2236    /// println!();
2237    /// let mut txt = String::new();
2238    /// for c in cipher.clone()
2239    ///     { write!(txt, "{:02X} ", c); }
2240    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
2241    /// ```
2242    /// 
2243    /// ## For more examples,
2244    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_array_into_vec)
2245    /// 
2246    /// # For BigCryptor64
2247    /// ## Example 1 for TDES case
2248    /// ```
2249    /// use std::io::Write;
2250    /// use std::fmt::Write as _;
2251    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
2252    /// 
2253    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
2254    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
2255    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
2256    /// let iv = 0x_FEDCBA0987654321_u64;
2257    /// println!("IV =	{:#018X}", iv);
2258    /// let mes = "In the beginning God created the heavens and the earth.";
2259    /// println!("M =\t{}", mes);
2260    /// let mut message = [0_u8; 55];
2261    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2262    /// let mut cipher = Vec::<u8>::new();
2263    /// tdes.encrypt_array_into_vec(iv, &message, &mut cipher);
2264    /// print!("C =\t");
2265    /// for c in cipher.clone()
2266    ///     { print!("{:02X} ", c); }
2267    /// println!();
2268    /// let mut txt = String::new();
2269    /// for c in cipher.clone()
2270    ///     { write!(txt, "{:02X} ", c); }
2271    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
2272    /// ```
2273    /// 
2274    /// ## For more examples,
2275    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_array_into_vec)
2276    #[inline]
2277    fn encrypt_array_into_vec<U, V, const N: usize>(&mut self, iv: T, message: &[U; N], cipher: &mut Vec<V>) -> u64
2278    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
2279    {
2280        self.encrypt_into_vec(iv, message.as_ptr() as *const u8, (N as u32 * U::size_in_bytes()) as u64, cipher)
2281    }
2282
2283    // fn encrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, iv: T, message: &[U; N], cipher: &mut [V; M]) -> u64
2284    /// Encrypts the data stored in an array `[U; N]` object with the padding
2285    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and stores the
2286    /// encrypted data in array `[V; M]`.
2287    /// 
2288    /// # Arguments
2289    /// - `iv` is an initialization vector for PCBC mode.
2290    /// - `message` is an immutable reference to an array `[U; N]` object, and
2291    ///   is the place where the plaintext to be encrypted is stored.
2292    /// - `cipher` is a mutable reference to an array `[U; N]` object, and
2293    ///   is the place where the encrypted data will be stored.
2294    /// 
2295    /// # Output
2296    /// - This method returns the size of ciphertext including padding bits
2297    ///   in bytes.
2298    /// - The output will be at least `size_of::<T>()`,
2299    ///   and cannot be other than a multiple of `size_of::<T>()`.
2300    /// - If this method failed in encryption, this method returns `zero`.
2301    /// 
2302    /// # Features
2303    /// - If `message` is an empty array `[U; 0]` object, only padding bytes
2304    ///   will be encrypted, and stored in the array `[V; M]` object `cipher`.
2305    /// - If `V::size_in_bytes()` * `M` is less than 
2306    ///   `U::size_in_bytes()` * `N`'s next multiple of `size_of::<T>()`,
2307    ///   this method does not perform encryption and returns `zero`.
2308    /// - If `V::size_in_bytes()` * `M` is equal to
2309    ///   `U::size_in_bytes()` * `N`'s next multiple of `size_of::<T>()`,
2310    ///   this method performs encryption, fills the array `cipher` with the
2311    ///   encrypted ciphertext, and returns the size of the ciphertext including
2312    ///   padding bits in bytes.
2313    /// - If `V::size_in_bytes()` * `M` is greater than
2314    ///   `U::size_in_bytes()` * `N`'s next multiple of `size_of::<T>()`,
2315    ///   this method performs encryption, fills the array `cipher` with the
2316    ///   encrypted ciphertext, and then fills the rest of the elements of the
2317    ///   array `cipher` with zeros, and returns the size of the ciphertext
2318    ///   including padding bits in bytes.
2319    /// - The size of the area for ciphertext should be prepared to be
2320    ///   (`size_of::<U>()` * `message.len()` + `1`).next_multiple_of(`size_of::<T>()`)
2321    ///   at least.
2322    ///   So, it is responsible for you to prepare the `cipher` area big enough!
2323    /// - The padding bits are composed of the bytes that indicate the length of
2324    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
2325    /// - For more information about the padding bits according to PKCS#7,
2326    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
2327    /// 
2328    /// # For Rijndael or AES, and its variants
2329    /// ## Example 1 for AES-128
2330    /// ```
2331    /// use std::io::Write;
2332    /// use std::fmt::Write as _;
2333    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
2334    /// 
2335    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
2336    /// println!("K =\t{:#016X}", key);
2337    /// let mut a_aes = AES_128::new_with_key_u128(key);
2338    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2339    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2340    /// 
2341    /// let mes = "In the beginning God created the heavens and the earth.";
2342    /// println!("M =\t{}", mes);
2343    /// let mut message = [0_u8; 55];
2344    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2345    /// let mut cipher = [0_u8; 64];
2346    /// a_aes.encrypt_array_into_array(iv, &message, &mut cipher);
2347    /// print!("C =\t");
2348    /// for c in cipher.clone()
2349    ///     { print!("{:02X} ", c); }
2350    /// println!();
2351    /// let mut txt = String::new();
2352    /// for c in cipher.clone()
2353    ///     { write!(txt, "{:02X} ", c); }
2354    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2355    /// ```
2356    /// 
2357    /// ## For more examples,
2358    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.encrypt_array_into_array)
2359    /// 
2360    /// # For DES and its variants
2361    /// ## Example 1 for Normal case
2362    /// ```
2363    /// use std::io::Write;
2364    /// use std::fmt::Write as _;
2365    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
2366    /// 
2367    /// let key = 0x_1234567890ABCDEF_u64;
2368    /// println!("K =\t{:#016X}", key);
2369    /// let mut a_des = DES::new_with_key_u64(key);
2370    ///
2371    /// let mes = "In the beginning God created the heavens and the earth.";
2372    /// println!("M =\t{}", mes);
2373    /// let mut message = [0_u8; 55];
2374    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2375    /// let iv = 0x_FEDCBA0987654321_u64;
2376    /// println!("IV =	{}", iv);
2377    /// let mut cipher = [0_u8; 56];
2378    /// a_des.encrypt_array_into_array(iv, &message, &mut cipher);
2379    /// for c in cipher.clone()
2380    ///     { print!("{:02X} ", c); }
2381    /// println!();
2382    /// let mut txt = String::new();
2383    /// for c in cipher.clone()
2384    ///     { write!(txt, "{:02X} ", c); }
2385    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
2386    /// ```
2387    /// 
2388    /// ## For more examples,
2389    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.encrypt_array_into_array)
2390    /// 
2391    /// # For BigCryptor128
2392    /// ## Example 1 for TAES case
2393    /// ```
2394    /// use std::io::Write;
2395    /// use std::fmt::Write as _;
2396    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
2397    /// 
2398    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
2399    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
2400    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
2401    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
2402    /// println!("IV =	{:#034X}", iv);
2403    /// let mes = "In the beginning God created the heavens and the earth.";
2404    /// println!("M =\t{}", mes);
2405    /// let mut message = [0_u8; 55];
2406    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2407    /// let mut cipher = [0_u8; 64];
2408    /// taes.encrypt_array_into_array(iv, &message, &mut cipher);
2409    /// for c in cipher.clone()
2410    ///     { print!("{:02X} ", c); }
2411    /// println!();
2412    /// let mut txt = String::new();
2413    /// for c in cipher.clone()
2414    ///     { write!(txt, "{:02X} ", c); }
2415    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
2416    /// ```
2417    /// 
2418    /// ## For more examples,
2419    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.encrypt_array_into_array)
2420    /// 
2421    /// # For BigCryptor64
2422    /// ## Example 1 for TDES case
2423    /// ```
2424    /// use std::io::Write;
2425    /// use std::fmt::Write as _;
2426    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
2427    /// 
2428    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
2429    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
2430    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
2431    /// let iv = 0x_FEDCBA0987654321_u64;
2432    /// println!("IV =	{:#018X}", iv);
2433    /// let mes = "In the beginning God created the heavens and the earth.";
2434    /// println!("M =\t{}", mes);
2435    /// let mut message = [0_u8; 55];
2436    /// message.copy_from_slice(unsafe { mes.to_string().as_mut_vec() });
2437    /// let mut cipher = [0_u8; 56];
2438    /// tdes.encrypt_array_into_array(iv, &message, &mut cipher);
2439    /// for c in cipher.clone()
2440    ///     { print!("{:02X} ", c); }
2441    /// println!();
2442    /// let mut txt = String::new();
2443    /// for c in cipher.clone()
2444    ///     { write!(txt, "{:02X} ", c); }
2445    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
2446    /// ```
2447    /// 
2448    /// ## For more examples,
2449    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.encrypt_array_into_array)
2450    #[inline]
2451    fn encrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, iv: T, message: &[U; N], cipher: &mut [V; M]) -> u64
2452    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
2453    {
2454        self.encrypt_into_array(iv, message.as_ptr() as *const u8, (N as u32 * U::size_in_bytes()) as u64, cipher)
2455    }
2456
2457    // fn decrypt(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: *mut u8) -> u64;
2458    /// Decrypts the data with the padding defined according to PKCS #7
2459    /// in PCBC (Propagation Cipher-Block Chaining) mode.
2460    /// 
2461    /// # Arguments
2462    /// - `iv` is an initialization vector for PCBC mode.
2463    /// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
2464    ///   and is the place where the ciphertext to be decrypted is stored.
2465    /// - `length_in_bytes` is of `u64`-type,
2466    ///   and is the length of the ciphertext `cipher` in bytes.
2467    /// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
2468    ///   is the place where the decrypted data will be stored.
2469    /// 
2470    /// # Output
2471    /// - This method returns the size of plaintext in bytes.
2472    /// - If this method failed in decryption, it always returns `zero`.
2473    /// - Even if this method succeeded in decryption, it returns `zero` when
2474    ///   the original plaintext is zero-length empty data. Then, you will have
2475    ///   to check whether or not it failed by using the method
2476    ///   `is_successful()` or `is_failed()`.
2477    /// - If `length_in_bytes` is greater than `size_of::<T>()` (which means
2478    ///   that the original plaintext is surely not empty data) and it returns
2479    ///   `zero`, you can interpret it that this method surely failed in
2480    ///   decryption.
2481    /// 
2482    /// # Features
2483    /// - You are not encouraged to use this method in pure Rust programming.
2484    ///   Instead, use other safer methods such as `decrypt_*_into_*()`.
2485    /// - This method is useful to use in hybrid programming with C/C++.
2486    /// - `length_in_bytes` cannot be other than any multiple of `size_of::<T>()`.
2487    /// - The size of the memory area which starts at `message` is assumed to
2488    ///   be enough to store the plaintext. So, it is responsible for you to
2489    ///   prepare the `message` area big enough!
2490    /// - The size of the area for plaintext does not have to be prepared more
2491    ///   than `length_in_bytes` - `1`.
2492    /// - If the size of the area for plaintext is prepared more than
2493    ///   `length_in_bytes` - `1`, the rest of the area will be filled with
2494    ///   `0`s.
2495    /// - The padding bits are composed of the bytes that indicate the length of
2496    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
2497    /// - For more information about the padding bits according to PKCS #7,
2498    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
2499    /// 
2500    /// # For Rijndael or AES, and its variants
2501    /// ## Example 1 for AES-128
2502    /// ```
2503    /// use std::io::Write;
2504    /// use std::fmt::Write as _;
2505    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
2506    /// 
2507    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
2508    /// println!("K =\t{:#016X}", key);
2509    /// let mut a_aes = AES_128::new_with_key_u128(key);
2510    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2511    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2512    /// 
2513    /// let message = "In the beginning God created the heavens and the earth.";
2514    /// println!("M =\t{}", message);
2515    /// let mut cipher = [0_u8; 64];
2516    /// a_aes.encrypt_str(iv.clone(), &message, cipher.as_mut_ptr());
2517    /// print!("C =\t");
2518    /// for c in cipher.clone()
2519    ///     { print!("{:02X} ", c); }
2520    /// println!();
2521    /// let mut txt = String::new();
2522    /// for c in cipher.clone()
2523    ///     { write!(txt, "{:02X} ", c); }
2524    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2525    /// 
2526    /// let mut recovered = vec![0; 55];
2527    /// a_aes.decrypt(iv, cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
2528    /// print!("Ba =\t");
2529    /// for b in recovered.clone()
2530    ///     { print!("{:02X} ", b); }
2531    /// println!();
2532    /// let mut txt = String::new();
2533    /// for c in recovered.clone()
2534    ///     { write!(txt, "{:02X} ", c); }
2535    /// 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 ");
2536    /// 
2537    /// let mut converted = String::new();
2538    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2539    /// 
2540    /// println!("Bb =\t{}", converted);
2541    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2542    /// assert_eq!(converted, message);
2543    /// ```
2544    /// 
2545    /// ## For more examples,
2546    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt)
2547    /// 
2548    /// # For DES and its variants
2549    /// ## Example 1 for Normal case
2550    /// ```
2551    /// use std::io::Write;
2552    /// use std::fmt::Write as _;
2553    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
2554    /// 
2555    /// let key = 0x_1234567890ABCDEF_u64;
2556    /// println!("K =\t{:#016X}", key);
2557    /// let mut a_des = DES::new_with_key_u64(key);
2558    ///
2559    /// let message = "In the beginning God created the heavens and the earth.";
2560    /// println!("M =\t{}", message);
2561    /// let iv = 0x_FEDCBA0987654321_u64;
2562    /// println!("IV =	{}", iv);
2563    /// let mut cipher = Vec::<u8>::new();
2564    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
2565    /// print!("C (16 rounds) =\t");
2566    /// for c in cipher.clone()
2567    ///     { print!("{:02X} ", c); }
2568    /// println!();
2569    /// let mut txt = String::new();
2570    /// for c in cipher.clone()
2571    ///     { write!(txt, "{:02X} ", c); }
2572    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
2573    ///
2574    /// let mut recovered = vec![0; 55];
2575    /// a_des.decrypt(iv, cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
2576    /// print!("Ba (16 rounds) =\t");
2577    /// for b in recovered.clone()
2578    ///     { print!("{:02X} ", b); }
2579    /// println!();
2580    /// let mut txt = String::new();
2581    /// for c in recovered.clone()
2582    ///     { write!(txt, "{:02X} ", c); }
2583    /// 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 ");
2584    ///
2585    /// let mut converted = String::new();
2586    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2587    /// 
2588    /// println!("Bb (16 rounds) =\t{}", converted);
2589    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2590    /// assert_eq!(converted, message);
2591    /// ```
2592    /// 
2593    /// ## For more examples,
2594    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt)
2595    /// 
2596    /// # For BigCryptor128
2597    /// ## Example 1 for TAES case
2598    /// ```
2599    /// use std::io::Write;
2600    /// use std::fmt::Write as _;
2601    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
2602    /// 
2603    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
2604    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
2605    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
2606    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
2607    /// println!("IV =	{:#034X}", iv);
2608    /// let message = "In the beginning God created the heavens and the earth.";
2609    /// println!("M =\t{}", message);
2610    /// let mut cipher = Vec::<u8>::new();
2611    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
2612    /// print!("C =\t");
2613    /// for c in cipher.clone()
2614    ///     { print!("{:02X} ", c); }
2615    /// println!();
2616    /// let mut txt = String::new();
2617    /// for c in cipher.clone()
2618    ///     { write!(txt, "{:02X} ", c); }
2619    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
2620    /// 
2621    /// let mut recovered = vec![0; 55];
2622    /// taes.decrypt(iv, cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
2623    /// print!("Ba =\t");
2624    /// for b in recovered.clone()
2625    ///     { print!("{:02X} ", b); }
2626    /// println!();
2627    /// let mut txt = String::new();
2628    /// for c in recovered.clone()
2629    ///     { write!(txt, "{:02X} ", c); }
2630    /// 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 ");
2631    /// 
2632    /// let mut converted = String::new();
2633    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2634    /// 
2635    /// println!("Bb =\t{}", converted);
2636    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2637    /// assert_eq!(converted, message);
2638    /// ```
2639    /// 
2640    /// ## For more examples,
2641    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt)
2642    /// 
2643    /// # For BigCryptor64
2644    /// ## Example 1 for TDES case
2645    /// ```
2646    /// use std::io::Write;
2647    /// use std::fmt::Write as _;
2648    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
2649    /// 
2650    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
2651    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
2652    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
2653    /// let iv = 0x_FEDCBA0987654321_u64;
2654    /// println!("IV =	{:#018X}", iv);
2655    /// let message = "In the beginning God created the heavens and the earth.";
2656    /// println!("M =\t{}", message);
2657    /// let mut cipher = Vec::<u8>::new();
2658    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
2659    /// print!("C =\t");
2660    /// for c in cipher.clone()
2661    ///     { print!("{:02X} ", c); }
2662    /// println!();
2663    /// let mut txt = String::new();
2664    /// for c in cipher.clone()
2665    ///     { write!(txt, "{:02X} ", c); }
2666    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
2667    /// 
2668    /// let mut recovered = vec![0; 55];
2669    /// tdes.decrypt(iv, cipher.as_ptr(), cipher.len() as u64, recovered.as_mut_ptr());
2670    /// print!("Ba =\t");
2671    /// for b in recovered.clone()
2672    ///     { print!("{:02X} ", b); }
2673    /// println!();
2674    /// let mut txt = String::new();
2675    /// for c in recovered.clone()
2676    ///     { write!(txt, "{:02X} ", c); }
2677    /// 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 ");
2678    /// 
2679    /// let mut converted = String::new();
2680    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2681    /// 
2682    /// println!("Bb =\t{}", converted);
2683    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2684    /// assert_eq!(converted, message);
2685    /// ```
2686    /// 
2687    /// ## For more examples,
2688    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt)
2689    fn decrypt(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: *mut u8) -> u64;
2690
2691    // fn decrypt_into_vec<U>(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut Vec<U>) -> u64
2692    /// Decrypts the data with the padding defined according to PKCS #7
2693    /// in PCBC (Propagation Cipher-Block Chaining) mode, and stores the decrypted data
2694    /// in `Vec<U>`.
2695    /// 
2696    /// # Arguments
2697    /// - `iv` is an initialization vector for PCBC mode.
2698    /// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
2699    ///   and is the place where the ciphertext to be decrypted is stored.
2700    /// - `length_in_bytes` is of `u64`-type,
2701    ///   and is the length of the ciphertext `cipher` in bytes.
2702    /// - `message` is a mutable reference to `Vec<U>` object, and
2703    ///   is the place where the decrypted data will be stored.
2704    /// 
2705    /// # Output
2706    /// - This method returns the size of plaintext in bytes.
2707    /// - If this method failed in decryption, it always returns `zero`.
2708    /// - Even if this method succeeded in decryption, it returns `zero` when
2709    ///   the original plaintext is zero-length empty data. Then, you will have
2710    ///   to check whether or not it failed by using the method
2711    ///   `is_successful()` or `is_failed()`.
2712    /// - If `length_in_bytes` is greater than `size_of::<T>()` (which means
2713    ///   that the original plaintext is surely not empty data) and it returns
2714    ///   `zero`, you can interpret it that this method surely failed in
2715    ///   decryption.
2716    /// 
2717    /// # Features
2718    /// - You are not encouraged to use this method in pure Rust programming.
2719    ///   Instead, use other safer methods such as decrypt_*_into_vec().
2720    /// - This method is useful to use in hybrid programming with C/C++.
2721    /// - `length_in_bytes` cannot be other than any multiple of `size_of::<T>()`.
2722    /// - The padding bits are composed of the bytes that indicate the length of
2723    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
2724    /// - For more information about the padding bits according to PKCS #7,
2725    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
2726    /// - You don't have to worry about whether or not the size of the memory
2727    ///   area where the plaintext will be stored is enough.
2728    /// 
2729    /// # For Rijndael or AES, and its variants
2730    /// ## Example 1 for AES-128
2731    /// ```
2732    /// use std::io::Write;
2733    /// use std::fmt::Write as _;
2734    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
2735    /// 
2736    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
2737    /// println!("K =\t{:#016X}", key);
2738    /// let mut a_aes = AES_128::new_with_key_u128(key);
2739    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2740    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2741    /// 
2742    /// let message = "In the beginning God created the heavens and the earth.";
2743    /// println!("M =\t{}", message);
2744    /// let mut cipher = [0_u8; 64];
2745    /// a_aes.encrypt_str(iv.clone(), &message, cipher.as_mut_ptr());
2746    /// print!("C =\t");
2747    /// for c in cipher.clone()
2748    ///     { print!("{:02X} ", c); }
2749    /// println!();
2750    /// let mut txt = String::new();
2751    /// for c in cipher.clone()
2752    ///     { write!(txt, "{:02X} ", c); }
2753    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2754    /// 
2755    /// let mut recovered = Vec::<u8>::new();
2756    /// a_aes.decrypt_into_vec(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
2757    /// print!("Ba =\t");
2758    /// for b in recovered.clone()
2759    ///     { print!("{:02X} ", b); }
2760    /// println!();
2761    /// let mut txt = String::new();
2762    /// for c in recovered.clone()
2763    ///     { write!(txt, "{:02X} ", c); }
2764    /// 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 ");
2765    /// 
2766    /// let mut converted = String::new();
2767    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2768    /// 
2769    /// println!("Bb =\t{}", converted);
2770    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2771    /// assert_eq!(converted, message);
2772    /// ```
2773    /// 
2774    /// ## For more examples,
2775    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_into_vec)
2776    /// 
2777    /// # For DES and its variants
2778    /// ## Example 1 for Normal case
2779    /// ```
2780    /// use std::io::Write;
2781    /// use std::fmt::Write as _;
2782    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
2783    /// 
2784    /// let key = 0x_1234567890ABCDEF_u64;
2785    /// println!("K =\t{:#016X}", key);
2786    /// let mut a_des = DES::new_with_key_u64(key);
2787    ///
2788    /// let message = "In the beginning God created the heavens and the earth.";
2789    /// println!("M =\t{}", message);
2790    /// let iv = 0x_FEDCBA0987654321_u64;
2791    /// println!("IV =	{}", iv);
2792    /// let mut cipher = Vec::<u8>::new();
2793    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
2794    /// print!("C (16 rounds) =\t");
2795    /// for c in cipher.clone()
2796    ///     { print!("{:02X} ", c); }
2797    /// println!();
2798    /// let mut txt = String::new();
2799    /// for c in cipher.clone()
2800    ///     { write!(txt, "{:02X} ", c); }
2801    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
2802    ///
2803    /// let mut recovered = Vec::<u8>::new();
2804    /// a_des.decrypt_into_vec(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
2805    /// print!("Ba (16 rounds) =\t");
2806    /// for b in recovered.clone()
2807    ///     { print!("{:02X} ", b); }
2808    /// println!();
2809    /// let mut txt = String::new();
2810    /// for c in recovered.clone()
2811    ///     { write!(txt, "{:02X} ", c); }
2812    /// 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 ");
2813    ///
2814    /// let mut converted = String::new();
2815    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2816    /// 
2817    /// println!("Bb (16 rounds) =\t{}", converted);
2818    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2819    /// assert_eq!(converted, message);
2820    /// ```
2821    /// 
2822    /// ## For more examples,
2823    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_into_vec)
2824    /// 
2825    /// # For BigCryptor128
2826    /// ## Example 1 for TAES case
2827    /// ```
2828    /// use std::io::Write;
2829    /// use std::fmt::Write as _;
2830    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
2831    /// 
2832    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
2833    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
2834    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
2835    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
2836    /// println!("IV =	{:#034X}", iv);
2837    /// let message = "In the beginning God created the heavens and the earth.";
2838    /// println!("M =\t{}", message);
2839    /// let mut cipher = Vec::<u8>::new();
2840    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
2841    /// print!("C =\t");
2842    /// for c in cipher.clone()
2843    ///     { print!("{:02X} ", c); }
2844    /// println!();
2845    /// let mut txt = String::new();
2846    /// for c in cipher.clone()
2847    ///     { write!(txt, "{:02X} ", c); }
2848    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
2849    /// 
2850    /// let mut recovered = Vec::<u8>::new();
2851    /// taes.decrypt_into_vec(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
2852    /// print!("Ba =\t");
2853    /// for b in recovered.clone()
2854    ///     { print!("{:02X} ", b); }
2855    /// println!();
2856    /// let mut txt = String::new();
2857    /// for c in recovered.clone()
2858    ///     { write!(txt, "{:02X} ", c); }
2859    /// 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 ");
2860    /// 
2861    /// let mut converted = String::new();
2862    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2863    /// 
2864    /// println!("Bb =\t{}", converted);
2865    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2866    /// assert_eq!(converted, message);
2867    /// ```
2868    /// 
2869    /// ## For more examples,
2870    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_into_vec)
2871    /// 
2872    /// # For BigCryptor64
2873    /// ## Example 1 for TDES case
2874    /// ```
2875    /// use std::io::Write;
2876    /// use std::fmt::Write as _;
2877    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
2878    /// 
2879    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
2880    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
2881    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
2882    /// let iv = 0x_FEDCBA0987654321_u64;
2883    /// println!("IV =	{:#018X}", iv);
2884    /// let message = "In the beginning God created the heavens and the earth.";
2885    /// println!("M =\t{}", message);
2886    /// let mut cipher = Vec::<u8>::new();
2887    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
2888    /// print!("C =\t");
2889    /// for c in cipher.clone()
2890    ///     { print!("{:02X} ", c); }
2891    /// println!();
2892    /// let mut txt = String::new();
2893    /// for c in cipher.clone()
2894    ///     { write!(txt, "{:02X} ", c); }
2895    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
2896    /// 
2897    /// let mut recovered = Vec::<u8>::new();
2898    /// tdes.decrypt_into_vec(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
2899    /// print!("Ba =\t");
2900    /// for b in recovered.clone()
2901    ///     { print!("{:02X} ", b); }
2902    /// println!();
2903    /// let mut txt = String::new();
2904    /// for c in recovered.clone()
2905    ///     { write!(txt, "{:02X} ", c); }
2906    /// 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 ");
2907    /// 
2908    /// let mut converted = String::new();
2909    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
2910    /// 
2911    /// println!("Bb =\t{}", converted);
2912    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
2913    /// assert_eq!(converted, message);
2914    /// ```
2915    /// 
2916    /// ## For more examples,
2917    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_into_vec)
2918    fn decrypt_into_vec<U>(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut Vec<U>) -> u64
2919    where U: SmallUInt + Copy + Clone
2920    {
2921        pre_decrypt_into_vec!(message, length_in_bytes, U);
2922        let len = self.decrypt(iv, cipher, length_in_bytes, message.as_mut_ptr() as *mut u8);
2923        message.truncate(len as usize);
2924        len
2925    }
2926
2927    // fn decrypt_into_array<U, const N: usize>(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut [U; N]) -> u64
2928    /// Decrypts the data with the padding defined according to PKCS #7
2929    /// in PCBC (Propagation Cipher-Block Chaining) mode, and stores the decrypted data
2930    /// in array `[U; N]`.
2931    /// 
2932    /// # Arguments
2933    /// - `iv` is an initialization vector for PCBC mode.
2934    /// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
2935    ///   and is the place where the ciphertext to be decrypted is stored.
2936    /// - `length_in_bytes` is of `u64`-type,
2937    ///   and is the length of the ciphertext `cipher` in bytes.
2938    /// - `message` is a mutable reference to an array `[U; N]` object, and
2939    ///   is the place where the decrypted data will be stored.
2940    /// 
2941    /// # Output
2942    /// - This method returns the size of plaintext in bytes.
2943    /// - If this method failed in decryption, it always returns `zero`.
2944    /// - Even if this method succeeded in decryption, it returns `zero` when
2945    ///   the original plaintext is zero-length empty data. Then, you will have
2946    ///   to check whether or not it failed by using the method
2947    ///   `is_successful()` or `is_failed()`.
2948    /// - If `length_in_bytes` is greater than `size_of::<T>()` (which means
2949    ///   that the original plaintext is surely not empty data) and it returns
2950    ///   `zero`, you can interpret it that this method surely failed in
2951    ///   decryption.
2952    /// 
2953    /// # Features
2954    /// - You are not encouraged to use this method in pure Rust programming.
2955    ///   Instead, use other safer methods such as decrypt_*_into_array().
2956    /// - This method is useful to use in hybrid programming with C/C++.
2957    /// - `length_in_bytes` cannot be other than any multiple of `size_of::<T>()`.
2958    /// - If `U::size_in_bytes()` * `N` is less than `length_in_bytes` - `1`,
2959    ///   this method does not perform decryption but returns `zero`.
2960    /// - If `U::size_in_bytes()` * `N` is equal to or greater than
2961    ///   `length_in_bytes` - `1`, this method performs decryption, fills the
2962    ///   array `message` with the decrypted data, and then fills the rest of
2963    ///   the elements of the array `message` with zeros, and returns the size
2964    ///   of the plaintext.
2965    /// - It is responsible for you to prepare the `message` area big enough!
2966    /// - The size of the area for plaintext does not have to be prepared more
2967    ///   than `length_in_bytes` - `1`.
2968    /// - The padding bits are composed of the bytes that indicate the length of
2969    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
2970    /// - For more information about the padding bits according to PKCS #7,
2971    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
2972    /// 
2973    /// # For Rijndael or AES, and its variants
2974    /// ## Example 1 for AES-128
2975    /// ```
2976    /// use std::io::Write;
2977    /// use std::fmt::Write as _;
2978    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
2979    /// 
2980    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
2981    /// println!("K =\t{:#016X}", key);
2982    /// let mut a_aes = AES_128::new_with_key_u128(key);
2983    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
2984    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
2985    /// 
2986    /// let message = "In the beginning God created the heavens and the earth.";
2987    /// println!("M =\t{}", message);
2988    /// let mut cipher = [0_u8; 64];
2989    /// a_aes.encrypt_str(iv.clone(), &message, cipher.as_mut_ptr());
2990    /// print!("C =\t");
2991    /// for c in cipher.clone()
2992    ///     { print!("{:02X} ", c); }
2993    /// println!();
2994    /// let mut txt = String::new();
2995    /// for c in cipher.clone()
2996    ///     { write!(txt, "{:02X} ", c); }
2997    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
2998    /// 
2999    /// let mut recovered = [0; 64];
3000    /// let len = a_aes.decrypt_into_array(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3001    /// print!("Ba =\t");
3002    /// for b in recovered.clone()
3003    ///     { print!("{:02X} ", b); }
3004    /// println!();
3005    /// let mut txt = String::new();
3006    /// for c in recovered.clone()
3007    ///     { write!(txt, "{:02X} ", c); }
3008    /// 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 00 00 00 00 00 00 00 00 ");
3009    /// 
3010    /// let mut converted = String::new();
3011    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3012    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3013    /// 
3014    /// println!("Bb =\t{}", converted);
3015    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3016    /// assert_eq!(converted, message);
3017    /// ```
3018    /// 
3019    /// ## For more examples,
3020    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_into_array)
3021    /// 
3022    /// # For DES and its variants
3023    /// ## Example 1 for Normal case
3024    /// ```
3025    /// use std::io::Write;
3026    /// use std::fmt::Write as _;
3027    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
3028    /// 
3029    /// let key = 0x_1234567890ABCDEF_u64;
3030    /// println!("K =\t{:#016X}", key);
3031    /// let mut a_des = DES::new_with_key_u64(key);
3032    ///
3033    /// let message = "In the beginning God created the heavens and the earth.";
3034    /// println!("M =\t{}", message);
3035    /// let iv = 0x_FEDCBA0987654321_u64;
3036    /// println!("IV =	{}", iv);
3037    /// let mut cipher = Vec::<u8>::new();
3038    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
3039    /// print!("C (16 rounds) =\t");
3040    /// for c in cipher.clone()
3041    ///     { print!("{:02X} ", c); }
3042    /// println!();
3043    /// let mut txt = String::new();
3044    /// for c in cipher.clone()
3045    ///     { write!(txt, "{:02X} ", c); }
3046    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
3047    ///
3048    /// let mut recovered = [0u8; 56];
3049    /// let len = a_des.decrypt_into_array(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3050    /// print!("Ba (16 rounds) =\t");
3051    /// for b in recovered.clone()
3052    ///     { print!("{:02X} ", b); }
3053    /// println!();
3054    /// let mut txt = String::new();
3055    /// for c in recovered.clone()
3056    ///     { write!(txt, "{:02X} ", c); }
3057    /// 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 ");
3058    ///
3059    /// let mut converted = String::new();
3060    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3061    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3062    /// println!("Bb (16 rounds) =\t{}", converted);
3063    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3064    /// assert_eq!(converted, message);
3065    /// ```
3066    /// 
3067    /// ## For more examples,
3068    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_into_array)
3069    /// 
3070    /// # For BigCryptor128
3071    /// ## Example 1 for TAES case
3072    /// ```
3073    /// use std::io::Write;
3074    /// use std::fmt::Write as _;
3075    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
3076    /// 
3077    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
3078    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
3079    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
3080    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
3081    /// println!("IV =	{:#034X}", iv);
3082    /// let message = "In the beginning God created the heavens and the earth.";
3083    /// println!("M =\t{}", message);
3084    /// let mut cipher = Vec::<u8>::new();
3085    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
3086    /// print!("C =\t");
3087    /// for c in cipher.clone()
3088    ///     { print!("{:02X} ", c); }
3089    /// println!();
3090    /// let mut txt = String::new();
3091    /// for c in cipher.clone()
3092    ///     { write!(txt, "{:02X} ", c); }
3093    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
3094    /// 
3095    /// let mut recovered = [0u8; 64];
3096    /// let len = taes.decrypt_into_array(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3097    /// print!("Ba =\t");
3098    /// for b in recovered.clone()
3099    ///     { print!("{:02X} ", b); }
3100    /// println!();
3101    /// let mut txt = String::new();
3102    /// for c in recovered.clone()
3103    ///     { write!(txt, "{:02X} ", c); }
3104    /// 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 00 00 00 00 00 00 00 00 ");
3105    /// 
3106    /// let mut converted = String::new();
3107    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3108    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3109    /// println!("Bb =\t{}", converted);
3110    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3111    /// assert_eq!(converted, message);
3112    /// ```
3113    /// 
3114    /// ## For more examples,
3115    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_into_array)
3116    /// 
3117    /// # For BigCryptor64
3118    /// ## Example 1 for TDES case
3119    /// ```
3120    /// use std::io::Write;
3121    /// use std::fmt::Write as _;
3122    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
3123    /// 
3124    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
3125    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
3126    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
3127    /// let iv = 0x_FEDCBA0987654321_u64;
3128    /// println!("IV =	{:#018X}", iv);
3129    /// let message = "In the beginning God created the heavens and the earth.";
3130    /// println!("M =\t{}", message);
3131    /// let mut cipher = Vec::<u8>::new();
3132    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
3133    /// print!("C =\t");
3134    /// for c in cipher.clone()
3135    ///     { print!("{:02X} ", c); }
3136    /// println!();
3137    /// let mut txt = String::new();
3138    /// for c in cipher.clone()
3139    ///     { write!(txt, "{:02X} ", c); }
3140    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
3141    /// 
3142    /// let mut recovered = [0u8; 56];
3143    /// let len = tdes.decrypt_into_array(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3144    /// print!("Ba =\t");
3145    /// for b in recovered.clone()
3146    ///     { print!("{:02X} ", b); }
3147    /// println!();
3148    /// let mut txt = String::new();
3149    /// for c in recovered.clone()
3150    ///     { write!(txt, "{:02X} ", c); }
3151    /// 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 ");
3152    /// 
3153    /// let mut converted = String::new();
3154    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3155    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3156    /// println!("Bb =\t{}", converted);
3157    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3158    /// assert_eq!(converted, message);
3159    /// ```
3160    /// 
3161    /// ## For more examples,
3162    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_into_array)
3163    fn decrypt_into_array<U, const N: usize>(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut [U; N]) -> u64
3164    where U: SmallUInt + Copy + Clone;
3165
3166    // fn decrypt_into_string(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut String) -> u64
3167    /// Decrypts the data with the padding defined according to PKCS #7
3168    /// in PCBC (Propagation Cipher-Block Chaining) mode, and stores the decrypted data
3169    /// in a `String`.
3170    /// 
3171    /// # Arguments
3172    /// - `iv` is an initialization vector for PCBC mode.
3173    /// - `cipher` is an immutable pointer to `u8` which is `*const u8`,
3174    ///   and is the place where the ciphertext to be decrypted is stored.
3175    /// - `length_in_bytes` is of `u64`-type,
3176    ///   and is the length of the ciphertext `cipher` in bytes.
3177    /// - `message` is a mutable reference to a `String` object, and
3178    ///   is the place where the decrypted data will be stored.
3179    /// 
3180    /// # Output
3181    /// - This method returns the size of plaintext in bytes.
3182    /// - If this method failed in decryption, it always returns `zero`.
3183    /// - Even if this method succeeded in decryption, it returns `zero` when
3184    ///   the original plaintext is zero-length empty data. Then, you will have
3185    ///   to check whether or not it failed by using the method
3186    ///   `is_successful()` or `is_failed()`.
3187    /// - If `length_in_bytes` is greater than `size_of::<T>()` (which means
3188    ///   that the original plaintext is surely not empty data) and it returns
3189    ///   `zero`, you can interpret it that this method surely failed in
3190    ///   decryption.
3191    /// 
3192    /// # Features
3193    /// - You are not encouraged to use this method in pure Rust programming.
3194    ///   Instead, use other safer methods such as decrypt_*_into_string().
3195    /// - This method is useful to use in hybrid programming with C/C++.
3196    /// - `length_in_bytes` cannot be other than any multiple of `size_of::<T>()`.
3197    /// - The padding bits are composed of the bytes that indicate the length of
3198    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
3199    /// - For more information about the padding bits according to PKCS #7,
3200    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
3201    /// - You don't have to worry about whether or not the size of the memory
3202    ///   area where the plaintext will be stored is enough.
3203    /// - This method assumes that the original plaintext is a string
3204    ///   in the format of UTF-8.
3205    /// 
3206    /// # For Rijndael or AES, and its variants
3207    /// ## Example 1 for AES-128
3208    /// ```
3209    /// use std::io::Write;
3210    /// use std::fmt::Write as _;
3211    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
3212    /// 
3213    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
3214    /// println!("K =\t{:#016X}", key);
3215    /// let mut a_aes = AES_128::new_with_key_u128(key);
3216    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
3217    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
3218    /// 
3219    /// let message = "In the beginning God created the heavens and the earth.";
3220    /// println!("M =\t{}", message);
3221    /// let mut cipher = [0_u8; 64];
3222    /// a_aes.encrypt_str(iv.clone(), &message, cipher.as_mut_ptr());
3223    /// print!("C =\t");
3224    /// for c in cipher.clone()
3225    ///     { print!("{:02X} ", c); }
3226    /// println!();
3227    /// let mut txt = String::new();
3228    /// for c in cipher.clone()
3229    ///     { write!(txt, "{:02X} ", c); }
3230    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
3231    /// 
3232    /// let mut converted = String::new();
3233    /// a_aes.decrypt_into_string(iv, cipher.as_ptr(), cipher.len() as u64, &mut converted);
3234    /// println!("B =\t{}", converted);
3235    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3236    /// assert_eq!(converted, message);
3237    /// ```
3238    /// 
3239    /// ## For more examples,
3240    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_into_string)
3241    /// 
3242    /// # For DES and its variants
3243    /// ## Example 1 for Normal case
3244    /// ```
3245    /// use std::io::Write;
3246    /// use std::fmt::Write as _;
3247    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
3248    /// 
3249    /// let key = 0x_1234567890ABCDEF_u64;
3250    /// println!("K =\t{:#016X}", key);
3251    /// let mut a_des = DES::new_with_key_u64(key);
3252    ///
3253    /// let message = "In the beginning God created the heavens and the earth.";
3254    /// println!("M =\t{}", message);
3255    /// let iv = 0x_FEDCBA0987654321_u64;
3256    /// println!("IV =	{}", iv);
3257    /// let mut cipher = Vec::<u8>::new();
3258    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
3259    /// print!("C (16 rounds) =\t");
3260    /// for c in cipher.clone()
3261    ///     { print!("{:02X} ", c); }
3262    /// println!();
3263    /// let mut txt = String::new();
3264    /// for c in cipher.clone()
3265    ///     { write!(txt, "{:02X} ", c); }
3266    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
3267    ///
3268    /// let mut recovered = String::new();
3269    /// a_des.decrypt_into_string(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3270    /// println!("B (16 rounds) =\t{}", recovered);
3271    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
3272    /// assert_eq!(recovered, message);
3273    /// ```
3274    /// 
3275    /// ## For more examples,
3276    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_into_string)
3277    /// 
3278    /// # For BigCryptor128
3279    /// ## Example 1 for TAES case
3280    /// ```
3281    /// use std::io::Write;
3282    /// use std::fmt::Write as _;
3283    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
3284    /// 
3285    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
3286    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
3287    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
3288    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
3289    /// println!("IV =	{:#034X}", iv);
3290    /// let message = "In the beginning God created the heavens and the earth.";
3291    /// println!("M =\t{}", message);
3292    /// let mut cipher = Vec::<u8>::new();
3293    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
3294    /// print!("C =\t");
3295    /// for c in cipher.clone()
3296    ///     { print!("{:02X} ", c); }
3297    /// println!();
3298    /// let mut txt = String::new();
3299    /// for c in cipher.clone()
3300    ///     { write!(txt, "{:02X} ", c); }
3301    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
3302    /// 
3303    /// let mut recovered = String::new();
3304    /// taes.decrypt_into_string(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3305    /// println!("B =\t{}", recovered);
3306    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
3307    /// assert_eq!(recovered, message);
3308    /// ```
3309    /// 
3310    /// ## For more examples,
3311    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_into_string)
3312    /// 
3313    /// # For BigCryptor64
3314    /// ## Example 1 for TDES case
3315    /// ```
3316    /// use std::io::Write;
3317    /// use std::fmt::Write as _;
3318    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
3319    /// 
3320    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
3321    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
3322    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
3323    /// let iv = 0x_FEDCBA0987654321_u64;
3324    /// println!("IV =	{:#018X}", iv);
3325    /// let message = "In the beginning God created the heavens and the earth.";
3326    /// println!("M =\t{}", message);
3327    /// let mut cipher = Vec::<u8>::new();
3328    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
3329    /// print!("C =\t");
3330    /// for c in cipher.clone()
3331    ///     { print!("{:02X} ", c); }
3332    /// println!();
3333    /// let mut txt = String::new();
3334    /// for c in cipher.clone()
3335    ///     { write!(txt, "{:02X} ", c); }
3336    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
3337    /// 
3338    /// let mut recovered = String::new();
3339    /// tdes.decrypt_into_string(iv, cipher.as_ptr(), cipher.len() as u64, &mut recovered);
3340    /// println!("B =\t{}", recovered);
3341    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
3342    /// assert_eq!(recovered, message);
3343    /// ```
3344    /// 
3345    /// ## For more examples,
3346    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_into_string)
3347    #[inline]
3348    fn decrypt_into_string(&mut self, iv: T, cipher: *const u8, length_in_bytes: u64, message: &mut String) -> u64
3349    {
3350        self.decrypt_into_vec(iv, cipher, length_in_bytes, unsafe { message.as_mut_vec() })
3351    }
3352
3353    // fn decrypt_vec<U>(&mut self, iv: T, cipher: &Vec<U>, message: *mut u8) -> u64
3354    /// Decrypts the data stored in a `Vec<U>` object with the padding defined
3355    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
3356    /// 
3357    /// # Arguments
3358    /// - `iv` is an initialization vector for PCBC mode.
3359    /// - `cipher` is an immutable reference to `Vec<U>` object, and
3360    ///   is the place where the plaintext to be decrypted is stored.
3361    /// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
3362    ///   is the place where the decrypted data will be stored.
3363    /// 
3364    /// # Output
3365    /// - This method returns the size of plaintext in bytes.
3366    /// - If this method failed in decryption, it always returns `zero`.
3367    /// - Even if this method succeeded in decryption, it returns `zero` when
3368    ///   the original plaintext is zero-length empty data. Then, you will have
3369    ///   to check whether or not it failed by using the method
3370    ///   `is_successful()` or `is_failed()`.
3371    /// - If `size_of::<U>()` * `cipher.len()` is greater than `size_of::<T>()`
3372    ///   (which means that the original plaintext is surely not empty data)
3373    ///   and it returns `zero`, you can interpret it that this method surely
3374    ///   failed in decryption.
3375    /// 
3376    /// # Features
3377    /// - You are not encouraged to use this method in pure Rust programming.
3378    ///   Instead, use other safer methods such as decrypt_vec_into_*().
3379    /// - This method is useful to use in hybrid programming with C/C++.
3380    /// - `size_of::<U>()` * `cipher.len()` cannot be other than any multiple
3381    ///   of `size_of::<T>()`.
3382    /// - The size of the memory area which starts at `message` is assumed to
3383    ///   be enough to store the plaintext. So, it is responsible for you to
3384    ///   prepare the `message` area big enough!
3385    /// - The size of the area for plaintext does not have to be prepared more
3386    ///   than `size_of::<U>()` * `cipher.len()` - `1`.
3387    /// - If the size of the area for plaintext is prepared more than
3388    ///   `size_of::<U>()` * `cipher.len()` - `1`, the rest of the area will be
3389    ///   filled with `0`s.
3390    /// - The padding bits are composed of the bytes that indicate the length of
3391    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
3392    /// - For more information about the padding bits according to PKCS #7,
3393    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
3394    /// 
3395    /// # For Rijndael or AES, and its variants
3396    /// ## Example 1 for AES-128
3397    /// ```
3398    /// use std::io::Write;
3399    /// use std::fmt::Write as _;
3400    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
3401    /// 
3402    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
3403    /// println!("K =\t{:#016X}", key);
3404    /// let mut a_aes = AES_128::new_with_key_u128(key);
3405    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
3406    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
3407    /// 
3408    /// let message = "In the beginning God created the heavens and the earth.";
3409    /// println!("M =\t{}", message);
3410    /// let mut cipher = Vec::<u8>::new();
3411    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
3412    /// print!("C =\t");
3413    /// for c in cipher.clone()
3414    ///     { print!("{:02X} ", c); }
3415    /// println!();
3416    /// let mut txt = String::new();
3417    /// for c in cipher.clone()
3418    ///     { write!(txt, "{:02X} ", c); }
3419    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
3420    /// 
3421    /// let mut recovered = vec![0; 55];
3422    /// a_aes.decrypt_vec(iv, &cipher, recovered.as_mut_ptr());
3423    /// print!("Ba =\t");
3424    /// for b in recovered.clone()
3425    ///     { print!("{:02X} ", b); }
3426    /// println!();
3427    /// let mut txt = String::new();
3428    /// for c in recovered.clone()
3429    ///     { write!(txt, "{:02X} ", c); }
3430    /// 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 ");
3431    /// 
3432    /// let mut converted = String::new();
3433    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3434    /// 
3435    /// println!("Bb =\t{}", converted);
3436    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3437    /// assert_eq!(converted, message);
3438    /// ```
3439    /// 
3440    /// ## For more examples,
3441    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_vec)
3442    /// 
3443    /// # For DES and its variants
3444    /// ## Example 1 for Normal case
3445    /// ```
3446    /// use std::io::Write;
3447    /// use std::fmt::Write as _;
3448    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
3449    /// 
3450    /// let key = 0x_1234567890ABCDEF_u64;
3451    /// println!("K =\t{:#016X}", key);
3452    /// let mut a_des = DES::new_with_key_u64(key);
3453    ///
3454    /// let message = "In the beginning God created the heavens and the earth.";
3455    /// println!("M =\t{}", message);
3456    /// let iv = 0x_FEDCBA0987654321_u64;
3457    /// println!("IV =	{}", iv);
3458    /// let mut cipher = Vec::<u8>::new();
3459    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
3460    /// print!("C (16 rounds) =\t");
3461    /// for c in cipher.clone()
3462    ///     { print!("{:02X} ", c); }
3463    /// println!();
3464    /// let mut txt = String::new();
3465    /// for c in cipher.clone()
3466    ///     { write!(txt, "{:02X} ", c); }
3467    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
3468    ///
3469    /// let mut recovered = vec![0; 55];
3470    /// a_des.decrypt_vec(iv, &cipher, recovered.as_mut_ptr());
3471    /// print!("Ba (16 rounds) =\t");
3472    /// for b in recovered.clone()
3473    ///     { print!("{:02X} ", b); }
3474    /// println!();
3475    /// let mut txt = String::new();
3476    /// for c in recovered.clone()
3477    ///     { write!(txt, "{:02X} ", c); }
3478    /// 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 ");
3479    ///
3480    /// let mut converted = String::new();
3481    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3482    /// 
3483    /// println!("Bb (16 rounds) =\t{}", converted);
3484    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3485    /// assert_eq!(converted, message);
3486    /// ```
3487    /// 
3488    /// ## For more examples,
3489    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_vec)
3490    /// 
3491    /// # For BigCryptor128
3492    /// ## Example 1 for TAES case
3493    /// ```
3494    /// use std::io::Write;
3495    /// use std::fmt::Write as _;
3496    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
3497    /// 
3498    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
3499    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
3500    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
3501    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
3502    /// println!("IV =	{:#034X}", iv);
3503    /// let message = "In the beginning God created the heavens and the earth.";
3504    /// println!("M =\t{}", message);
3505    /// let mut cipher = Vec::<u8>::new();
3506    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
3507    /// print!("C =\t");
3508    /// for c in cipher.clone()
3509    ///     { print!("{:02X} ", c); }
3510    /// println!();
3511    /// let mut txt = String::new();
3512    /// for c in cipher.clone()
3513    ///     { write!(txt, "{:02X} ", c); }
3514    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
3515    /// 
3516    /// let mut recovered = vec![0; 55];
3517    /// taes.decrypt_vec(iv, &cipher, recovered.as_mut_ptr());
3518    /// print!("Ba =\t");
3519    /// for b in recovered.clone()
3520    ///     { print!("{:02X} ", b); }
3521    /// println!();
3522    /// let mut txt = String::new();
3523    /// for c in recovered.clone()
3524    ///     { write!(txt, "{:02X} ", c); }
3525    /// 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 ");
3526    /// 
3527    /// let mut converted = String::new();
3528    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3529    /// 
3530    /// println!("Bb =\t{}", converted);
3531    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3532    /// assert_eq!(converted, message);
3533    /// ```
3534    /// 
3535    /// ## For more examples,
3536    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_vec)
3537    /// 
3538    /// # For BigCryptor64
3539    /// ## Example 1 for TDES case
3540    /// ```
3541    /// use std::io::Write;
3542    /// use std::fmt::Write as _;
3543    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
3544    /// 
3545    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
3546    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
3547    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
3548    /// let iv = 0x_FEDCBA0987654321_u64;
3549    /// println!("IV =	{:#018X}", iv);
3550    /// let message = "In the beginning God created the heavens and the earth.";
3551    /// println!("M =\t{}", message);
3552    /// let mut cipher = Vec::<u8>::new();
3553    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
3554    /// print!("C =\t");
3555    /// for c in cipher.clone()
3556    ///     { print!("{:02X} ", c); }
3557    /// println!();
3558    /// let mut txt = String::new();
3559    /// for c in cipher.clone()
3560    ///     { write!(txt, "{:02X} ", c); }
3561    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
3562    /// 
3563    /// let mut recovered = vec![0; 55];
3564    /// tdes.decrypt_vec(iv, &cipher, recovered.as_mut_ptr());
3565    /// print!("Ba =\t");
3566    /// for b in recovered.clone()
3567    ///     { print!("{:02X} ", b); }
3568    /// println!();
3569    /// let mut txt = String::new();
3570    /// for c in recovered.clone()
3571    ///     { write!(txt, "{:02X} ", c); }
3572    /// 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 ");
3573    /// 
3574    /// let mut converted = String::new();
3575    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3576    /// 
3577    /// println!("Bb =\t{}", converted);
3578    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3579    /// assert_eq!(converted, message);
3580    /// ```
3581    /// 
3582    /// ## For more examples,
3583    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_vec)
3584    #[inline]
3585    fn decrypt_vec<U>(&mut self, iv: T, cipher: &Vec<U>, message: *mut u8) -> u64
3586    where U: SmallUInt + Copy + Clone
3587    {
3588        self.decrypt(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
3589    }
3590
3591    // fn decrypt_vec_into_vec<U, V>(&mut self, iv: T, cipher: &Vec<U>, message: &mut Vec<V>) -> u64
3592    /// Decrypts the data stored in a `Vec<U>` object with the padding defined
3593    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and
3594    /// stores the decrypted data in `Vec<V>`.
3595    /// 
3596    /// # Arguments
3597    /// - `iv` is an initialization vector for PCBC mode.
3598    /// - `cipher` is an immutable reference to `Vec<U>` object, and
3599    ///   is the place where the ciphertext to be decrypted is stored.
3600    /// - `message` is a mutable reference to `Vec<U>` object, and
3601    ///   is the place where the decrypted data will be stored.
3602    /// 
3603    /// # Output
3604    /// - This method returns the size of plaintext in bytes.
3605    /// - If this method failed in decryption, it always returns `zero`.
3606    /// - Even if this method succeeded in decryption, it returns `zero` when
3607    ///   the original plaintext is zero-length empty data. Then, you will have
3608    ///   to check whether or not it failed by using the method
3609    ///   `is_successful()` or `is_failed()`.
3610    /// - If `size_of::<U>()` * `cipher.len()` is greater than `size_of::<T>()`
3611    ///   (which means that the original plaintext is surely not empty data)
3612    ///   and it returns `zero`, you can interpret it that this method surely
3613    ///   failed in decryption.
3614    /// 
3615    /// # Features
3616    /// - The padding bits are composed of the bytes that indicate the length of
3617    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
3618    /// - For more information about the padding bits according to PKCS #7,
3619    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
3620    /// - You don't have to worry about whether or not the size of the memory
3621    ///   area where the plaintext will be stored is enough.
3622    /// 
3623    /// # For Rijndael or AES, and its variants
3624    /// ## Example 1 for AES-128
3625    /// ```
3626    /// use std::io::Write;
3627    /// use std::fmt::Write as _;
3628    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
3629    /// 
3630    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
3631    /// println!("K =\t{:#016X}", key);
3632    /// let mut a_aes = AES_128::new_with_key_u128(key);
3633    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
3634    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
3635    /// 
3636    /// let message = "In the beginning God created the heavens and the earth.";
3637    /// println!("M =\t{}", message);
3638    /// let mut cipher = Vec::<u8>::new();
3639    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
3640    /// print!("C =\t");
3641    /// for c in cipher.clone()
3642    ///     { print!("{:02X} ", c); }
3643    /// println!();
3644    /// let mut txt = String::new();
3645    /// for c in cipher.clone()
3646    ///     { write!(txt, "{:02X} ", c); }
3647    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
3648    /// 
3649    /// let mut recovered = Vec::<u8>::new();
3650    /// a_aes.decrypt_vec_into_vec(iv, &cipher, &mut recovered);
3651    /// print!("Ba =\t");
3652    /// for b in recovered.clone()
3653    ///     { print!("{:02X} ", b); }
3654    /// println!();
3655    /// let mut txt = String::new();
3656    /// for c in recovered.clone()
3657    ///     { write!(txt, "{:02X} ", c); }
3658    /// 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 ");
3659    /// 
3660    /// let mut converted = String::new();
3661    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3662    /// 
3663    /// println!("Bb =\t{}", converted);
3664    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3665    /// assert_eq!(converted, message);
3666    /// ```
3667    /// 
3668    /// ## For more examples,
3669    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_vec_into_vec)
3670    /// 
3671    /// # For DES and its variants
3672    /// ## Example 1 for Normal case
3673    /// ```
3674    /// use std::io::Write;
3675    /// use std::fmt::Write as _;
3676    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
3677    /// 
3678    /// let key = 0x_1234567890ABCDEF_u64;
3679    /// println!("K =\t{:#016X}", key);
3680    /// let mut a_des = DES::new_with_key_u64(key);
3681    ///
3682    /// let message = "In the beginning God created the heavens and the earth.";
3683    /// println!("M =\t{}", message);
3684    /// let iv = 0x_FEDCBA0987654321_u64;
3685    /// println!("IV =	{}", iv);
3686    /// let mut cipher = Vec::<u8>::new();
3687    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
3688    /// print!("C (16 rounds) =\t");
3689    /// for c in cipher.clone()
3690    ///     { print!("{:02X} ", c); }
3691    /// println!();
3692    /// let mut txt = String::new();
3693    /// for c in cipher.clone()
3694    ///     { write!(txt, "{:02X} ", c); }
3695    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
3696    ///
3697    /// let mut recovered = Vec::<u8>::new();
3698    /// a_des.decrypt_vec_into_vec(iv, &cipher, &mut recovered);
3699    /// print!("Ba (16 rounds) =\t");
3700    /// for b in recovered.clone()
3701    ///     { print!("{:02X} ", b); }
3702    /// println!();
3703    /// let mut txt = String::new();
3704    /// for c in recovered.clone()
3705    ///     { write!(txt, "{:02X} ", c); }
3706    /// 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 ");
3707    ///
3708    /// let mut converted = String::new();
3709    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3710    /// 
3711    /// println!("Bb (16 rounds) =\t{}", converted);
3712    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3713    /// assert_eq!(converted, message);
3714    /// ```
3715    /// 
3716    /// ## For more examples,
3717    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_vec_into_vec)
3718    /// 
3719    /// # For BigCryptor128
3720    /// ## Example 1 for TAES case
3721    /// ```
3722    /// use std::io::Write;
3723    /// use std::fmt::Write as _;
3724    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
3725    /// 
3726    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
3727    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
3728    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
3729    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
3730    /// println!("IV =	{:#034X}", iv);
3731    /// let message = "In the beginning God created the heavens and the earth.";
3732    /// println!("M =\t{}", message);
3733    /// let mut cipher = Vec::<u8>::new();
3734    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
3735    /// print!("C =\t");
3736    /// for c in cipher.clone()
3737    ///     { print!("{:02X} ", c); }
3738    /// println!();
3739    /// let mut txt = String::new();
3740    /// for c in cipher.clone()
3741    ///     { write!(txt, "{:02X} ", c); }
3742    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
3743    /// 
3744    /// let mut recovered = Vec::<u8>::new();
3745    /// taes.decrypt_vec_into_vec(iv, &cipher, &mut recovered);
3746    /// print!("Ba =\t");
3747    /// for b in recovered.clone()
3748    ///     { print!("{:02X} ", b); }
3749    /// println!();
3750    /// let mut txt = String::new();
3751    /// for c in recovered.clone()
3752    ///     { write!(txt, "{:02X} ", c); }
3753    /// 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 ");
3754    /// 
3755    /// let mut converted = String::new();
3756    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3757    /// 
3758    /// println!("Bb =\t{}", converted);
3759    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3760    /// assert_eq!(converted, message);
3761    /// ```
3762    /// 
3763    /// ## For more examples,
3764    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_vec_into_vec)
3765    /// 
3766    /// # For BigCryptor64
3767    /// ## Example 1 for TDES case
3768    /// ```
3769    /// use std::io::Write;
3770    /// use std::fmt::Write as _;
3771    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
3772    /// 
3773    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
3774    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
3775    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
3776    /// let iv = 0x_FEDCBA0987654321_u64;
3777    /// println!("IV =	{:#018X}", iv);
3778    /// let message = "In the beginning God created the heavens and the earth.";
3779    /// println!("M =\t{}", message);
3780    /// let mut cipher = Vec::<u8>::new();
3781    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
3782    /// print!("C =\t");
3783    /// for c in cipher.clone()
3784    ///     { print!("{:02X} ", c); }
3785    /// println!();
3786    /// let mut txt = String::new();
3787    /// for c in cipher.clone()
3788    ///     { write!(txt, "{:02X} ", c); }
3789    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
3790    /// 
3791    /// let mut recovered = Vec::<u8>::new();
3792    /// tdes.decrypt_vec_into_vec(iv, &cipher, &mut recovered);
3793    /// print!("Ba =\t");
3794    /// for b in recovered.clone()
3795    ///     { print!("{:02X} ", b); }
3796    /// println!();
3797    /// let mut txt = String::new();
3798    /// for c in recovered.clone()
3799    ///     { write!(txt, "{:02X} ", c); }
3800    /// 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 ");
3801    /// 
3802    /// let mut converted = String::new();
3803    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
3804    /// 
3805    /// println!("Bb =\t{}", converted);
3806    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3807    /// assert_eq!(converted, message);
3808    /// ```
3809    /// 
3810    /// ## For more examples,
3811    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_vec_into_vec)
3812    #[inline]
3813    fn decrypt_vec_into_vec<U, V>(&mut self, iv: T, cipher: &Vec<U>, message: &mut Vec<V>) -> u64
3814    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
3815    {
3816        self.decrypt_into_vec(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
3817    }
3818
3819    // fn decrypt_vec_into_array<U, V, const N: usize>(&mut self, iv: T, cipher: &Vec<U>, message: &mut [V; N]) -> u64
3820    /// Decrypts the data stored in a `Vec<U>` object with the padding defined
3821    /// according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and
3822    /// stores the decrypted data in array `[V; N]`.
3823    /// 
3824    /// # Arguments
3825    /// - `iv` is an initialization vector for PCBC mode.
3826    /// - `cipher` is an immutable reference to `Vec<U>` object, and
3827    ///   is the place where the ciphertext to be decrypted is stored.
3828    /// - `message` is a mutable reference to an array `[U; N]` object, and
3829    ///   is the place where the decrypted data will be stored.
3830    /// 
3831    /// # Output
3832    /// - This method returns the size of plaintext in bytes.
3833    /// - If this method failed in decryption, it always returns `zero`.
3834    /// - Even if this method succeeded in decryption, it returns `zero` when
3835    ///   the original plaintext is zero-length empty data. Then, you will have
3836    ///   to check whether or not it failed by using the method
3837    ///   `is_successful()` or `is_failed()`.
3838    /// - If `size_of::<U>()` * `cipher.len()` is greater than `size_of::<T>()`
3839    ///   (which means that the original plaintext is surely not empty data)
3840    ///   and it returns `zero`, you can interpret it that this method surely
3841    ///   failed in decryption.
3842    /// 
3843    /// # Features
3844    /// - If `size_of::<V>()` * `N` is less than 
3845    ///   `size_of::<U>()` * `cipher.len()` - `1`, this method does not perform
3846    ///   decryption but returns `zero`.
3847    /// - If `size_of::<V>()` * `N` is equal to or greater than
3848    ///   `size_of::<U>()` * `cipher.len()` - `1`, this method performs
3849    ///   decryption, fills the array `message` with the decrypted data, and then
3850    ///   fills the rest of the elements of the array `message` with zeros, and
3851    ///   returns the size of the plaintext.
3852    /// - It is responsible for you to prepare the `message` area big enough!
3853    /// - The size of the area for plaintext does not have to be prepared more
3854    ///   than `size_of::<U>()` * `cipher.len()` - `1`.
3855    /// - The padding bits are composed of the bytes that indicate the length of
3856    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
3857    /// - For more information about the padding bits according to PKCS #7,
3858    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
3859    /// 
3860    /// # For Rijndael or AES, and its variants
3861    /// ## Example 1 for AES-128
3862    /// ```
3863    /// use std::io::Write;
3864    /// use std::fmt::Write as _;
3865    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
3866    /// 
3867    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
3868    /// println!("K =\t{:#016X}", key);
3869    /// let mut a_aes = AES_128::new_with_key_u128(key);
3870    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
3871    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
3872    /// 
3873    /// let message = "In the beginning God created the heavens and the earth.";
3874    /// println!("M =\t{}", message);
3875    /// let mut cipher = Vec::<u8>::new();
3876    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
3877    /// print!("C =\t");
3878    /// for c in cipher.clone()
3879    ///     { print!("{:02X} ", c); }
3880    /// println!();
3881    /// let mut txt = String::new();
3882    /// for c in cipher.clone()
3883    ///     { write!(txt, "{:02X} ", c); }
3884    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
3885    /// 
3886    /// let mut recovered = [0; 64];
3887    /// let len = a_aes.decrypt_vec_into_array(iv, &cipher, &mut recovered);
3888    /// print!("Ba =\t");
3889    /// for b in recovered.clone()
3890    ///     { print!("{:02X} ", b); }
3891    /// println!();
3892    /// let mut txt = String::new();
3893    /// for c in recovered.clone()
3894    ///     { write!(txt, "{:02X} ", c); }
3895    /// 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 00 00 00 00 00 00 00 00 ");
3896    /// 
3897    /// let mut converted = String::new();
3898    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3899    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3900    /// println!("Bb =\t{}", converted);
3901    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3902    /// assert_eq!(converted, message);
3903    /// ```
3904    /// 
3905    /// ## For more examples,
3906    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_vec_into_array)
3907    /// 
3908    /// # For DES and its variants
3909    /// ## Example 1 for Normal case
3910    /// ```
3911    /// use std::io::Write;
3912    /// use std::fmt::Write as _;
3913    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
3914    /// 
3915    /// let key = 0x_1234567890ABCDEF_u64;
3916    /// println!("K =\t{:#016X}", key);
3917    /// let mut a_des = DES::new_with_key_u64(key);
3918    ///
3919    /// let message = "In the beginning God created the heavens and the earth.";
3920    /// println!("M =\t{}", message);
3921    /// let iv = 0x_FEDCBA0987654321_u64;
3922    /// println!("IV =	{}", iv);
3923    /// let mut cipher = Vec::<u8>::new();
3924    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
3925    /// print!("C (16 rounds) =\t");
3926    /// for c in cipher.clone()
3927    ///     { print!("{:02X} ", c); }
3928    /// println!();
3929    /// let mut txt = String::new();
3930    /// for c in cipher.clone()
3931    ///     { write!(txt, "{:02X} ", c); }
3932    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
3933    ///
3934    /// let mut recovered = [0u8; 56];
3935    /// let len = a_des.decrypt_vec_into_array(iv, &cipher, &mut recovered);
3936    /// print!("Ba (16 rounds) =\t");
3937    /// for b in recovered.clone()
3938    ///     { print!("{:02X} ", b); }
3939    /// println!();
3940    /// let mut txt = String::new();
3941    /// for c in recovered.clone()
3942    ///     { write!(txt, "{:02X} ", c); }
3943    /// 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 ");
3944    ///
3945    /// let mut converted = String::new();
3946    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3947    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3948    /// println!("Bb (16 rounds) =\t{}", converted);
3949    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3950    /// assert_eq!(converted, message);
3951    /// ```
3952    /// 
3953    /// ## For more examples,
3954    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_vec_into_array)
3955    /// 
3956    /// # For BigCryptor128
3957    /// ## Example 1 for TAES case
3958    /// ```
3959    /// use std::io::Write;
3960    /// use std::fmt::Write as _;
3961    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
3962    /// 
3963    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
3964    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
3965    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
3966    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
3967    /// println!("IV =	{:#034X}", iv);
3968    /// let message = "In the beginning God created the heavens and the earth.";
3969    /// println!("M =\t{}", message);
3970    /// let mut cipher = Vec::<u8>::new();
3971    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
3972    /// print!("C =\t");
3973    /// for c in cipher.clone()
3974    ///     { print!("{:02X} ", c); }
3975    /// println!();
3976    /// let mut txt = String::new();
3977    /// for c in cipher.clone()
3978    ///     { write!(txt, "{:02X} ", c); }
3979    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
3980    /// 
3981    /// let mut recovered = [0u8; 64];
3982    /// let len = taes.decrypt_vec_into_array(iv, &cipher, &mut recovered);
3983    /// print!("Ba =\t");
3984    /// for b in recovered.clone()
3985    ///     { print!("{:02X} ", b); }
3986    /// println!();
3987    /// let mut txt = String::new();
3988    /// for c in recovered.clone()
3989    ///     { write!(txt, "{:02X} ", c); }
3990    /// 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 00 00 00 00 00 00 00 00 ");
3991    /// 
3992    /// let mut converted = String::new();
3993    /// unsafe { converted.as_mut_vec() }.write(&recovered);
3994    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
3995    /// println!("Bb =\t{}", converted);
3996    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
3997    /// ```
3998    /// 
3999    /// ## For more examples,
4000    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_vec_into_array)
4001    /// 
4002    /// # For BigCryptor64
4003    /// ## Example 1 for TDES case
4004    /// ```
4005    /// use std::io::Write;
4006    /// use std::fmt::Write as _;
4007    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
4008    /// 
4009    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
4010    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
4011    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
4012    /// let iv = 0x_FEDCBA0987654321_u64;
4013    /// println!("IV =	{:#018X}", iv);
4014    /// let message = "In the beginning God created the heavens and the earth.";
4015    /// println!("M =\t{}", message);
4016    /// let mut cipher = Vec::<u8>::new();
4017    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
4018    /// print!("C =\t");
4019    /// for c in cipher.clone()
4020    ///     { print!("{:02X} ", c); }
4021    /// println!();
4022    /// let mut txt = String::new();
4023    /// for c in cipher.clone()
4024    ///     { write!(txt, "{:02X} ", c); }
4025    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
4026    /// 
4027    /// let mut recovered = [0u8; 56];
4028    /// let len = tdes.decrypt_vec_into_array(iv, &cipher, &mut recovered);
4029    /// print!("Ba =\t");
4030    /// for b in recovered.clone()
4031    ///     { print!("{:02X} ", b); }
4032    /// println!();
4033    /// let mut txt = String::new();
4034    /// for c in recovered.clone()
4035    ///     { write!(txt, "{:02X} ", c); }
4036    /// 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 ");
4037    /// 
4038    /// let mut converted = String::new();
4039    /// unsafe { converted.as_mut_vec() }.write(&recovered);
4040    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
4041    /// println!("Bb =\t{}", converted);
4042    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4043    /// ```
4044    /// 
4045    /// ## For more examples,
4046    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_vec_into_array)
4047    #[inline]
4048    fn decrypt_vec_into_array<U, V, const N: usize>(&mut self, iv: T, cipher: &Vec<U>, message: &mut [V; N]) -> u64
4049    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
4050    {
4051        self.decrypt_into_array(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
4052    }
4053
4054    // fn decrypt_vec_into_string(&mut self, iv: T, cipher: &str, message: &mut String) -> u64
4055    /// Decrypts the data in `str` with the padding defined according to
4056    /// PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode, and stores the
4057    /// decrypted data in `String`.
4058    /// 
4059    /// # Arguments
4060    /// - `iv` is an initialization vector for PCBC mode.
4061    /// - `cipher` is an immutable reference to `Vec<U>` object, and
4062    ///   is the place where the ciphertext to be decrypted is stored.
4063    /// - `message` is a mutable reference to a `String` object, and
4064    ///   is the place where the decrypted data will be stored.
4065    /// 
4066    /// # Output
4067    /// - This method returns the size of plaintext in bytes.
4068    /// - If this method failed in decryption, it always returns `zero`.
4069    /// - Even if this method succeeded in decryption, it returns `zero` when
4070    ///   the original plaintext is zero-length empty data. Then, you will have
4071    ///   to check whether or not it failed by using the method
4072    ///   `is_successful()` or `is_failed()`.
4073    /// - If `size_of::<U>()` * `cipher.len()` is greater than `size_of::<T>()`
4074    ///   (which means that the original plaintext is surely not empty data)
4075    ///   and it returns `zero`, you can interpret it that this method surely
4076    ///   failed in decryption.
4077    /// 
4078    /// # Features
4079    /// - The padding bits are composed of the bytes that indicate the length of
4080    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
4081    /// - For more information about the padding bits according to PKCS #7,
4082    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
4083    /// - You don't have to worry about whether or not the size of the memory
4084    ///   area where the plaintext will be stored is enough.
4085    /// - This method assumes that the original plaintext is a string
4086    ///   in the format of UTF-8.
4087    /// 
4088    /// # For Rijndael or AES, and its variants
4089    /// ## Example 1 for AES-128
4090    /// ```
4091    /// use std::io::Write;
4092    /// use std::fmt::Write as _;
4093    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
4094    /// 
4095    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
4096    /// println!("K =\t{:#016X}", key);
4097    /// let mut a_aes = AES_128::new_with_key_u128(key);
4098    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
4099    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
4100    /// 
4101    /// let message = "In the beginning God created the heavens and the earth.";
4102    /// println!("M =\t{}", message);
4103    /// let mut cipher = Vec::<u8>::new();
4104    /// a_aes.encrypt_str_into_vec(iv, &message, &mut cipher);
4105    /// print!("C =\t");
4106    /// for c in cipher.clone()
4107    ///     { print!("{:02X} ", c); }
4108    /// println!();
4109    /// let mut txt = String::new();
4110    /// for c in cipher.clone()
4111    ///     { write!(txt, "{:02X} ", c); }
4112    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
4113    /// 
4114    /// let mut converted= String::new();
4115    /// a_aes.decrypt_vec_into_string(iv, &cipher, &mut converted);
4116    /// println!("B =\t{}", converted);
4117    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4118    /// assert_eq!(converted, message);
4119    /// ```
4120    /// 
4121    /// ## For more examples,
4122    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_vec_into_string)
4123    /// 
4124    /// # For DES and its variants
4125    /// ## Example 1 for Normal case
4126    /// ```
4127    /// use std::io::Write;
4128    /// use std::fmt::Write as _;
4129    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
4130    /// 
4131    /// let key = 0x_1234567890ABCDEF_u64;
4132    /// println!("K =\t{:#016X}", key);
4133    /// let mut a_des = DES::new_with_key_u64(key);
4134    ///
4135    /// let message = "In the beginning God created the heavens and the earth.";
4136    /// println!("M =\t{}", message);
4137    /// let iv = 0x_FEDCBA0987654321_u64;
4138    /// println!("IV =	{}", iv);
4139    /// let mut cipher = Vec::<u8>::new();
4140    /// a_des.encrypt_str_into_vec(iv, &message, &mut cipher);
4141    /// print!("C (16 rounds) =\t");
4142    /// for c in cipher.clone()
4143    ///     { print!("{:02X} ", c); }
4144    /// println!();
4145    /// let mut txt = String::new();
4146    /// for c in cipher.clone()
4147    ///     { write!(txt, "{:02X} ", c); }
4148    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
4149    ///
4150    /// let mut recovered = String::new();
4151    /// a_des.decrypt_vec_into_string(iv, &cipher, &mut recovered);
4152    /// println!("B (16 rounds) =\t{}", recovered);
4153    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
4154    /// assert_eq!(recovered, message);
4155    /// ```
4156    /// 
4157    /// ## For more examples,
4158    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_vec_into_string)
4159    /// 
4160    /// # For BigCryptor128
4161    /// ## Example 1 for TAES case
4162    /// ```
4163    /// use std::io::Write;
4164    /// use std::fmt::Write as _;
4165    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
4166    /// 
4167    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
4168    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
4169    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
4170    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
4171    /// println!("IV =	{:#034X}", iv);
4172    /// let message = "In the beginning God created the heavens and the earth.";
4173    /// println!("M =\t{}", message);
4174    /// let mut cipher = Vec::<u8>::new();
4175    /// taes.encrypt_str_into_vec(iv, &message, &mut cipher);
4176    /// print!("C =\t");
4177    /// for c in cipher.clone()
4178    ///     { print!("{:02X} ", c); }
4179    /// println!();
4180    /// let mut txt = String::new();
4181    /// for c in cipher.clone()
4182    ///     { write!(txt, "{:02X} ", c); }
4183    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
4184    /// 
4185    /// let mut recovered = String::new();
4186    /// taes.decrypt_vec_into_string(iv, &cipher, &mut recovered);
4187    /// println!("B =\t{}", recovered);
4188    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
4189    /// assert_eq!(recovered, message);
4190    /// ```
4191    /// 
4192    /// ## For more examples,
4193    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_vec_into_string)
4194    /// 
4195    /// # For BigCryptor64
4196    /// ## Example 1 for TDES case
4197    /// ```
4198    /// use std::io::Write;
4199    /// use std::fmt::Write as _;
4200    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
4201    /// 
4202    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
4203    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
4204    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
4205    /// let iv = 0x_FEDCBA0987654321_u64;
4206    /// println!("IV =	{:#018X}", iv);
4207    /// let message = "In the beginning God created the heavens and the earth.";
4208    /// println!("M =\t{}", message);
4209    /// let mut cipher = Vec::<u8>::new();
4210    /// tdes.encrypt_str_into_vec(iv, &message, &mut cipher);
4211    /// print!("C =\t");
4212    /// for c in cipher.clone()
4213    ///     { print!("{:02X} ", c); }
4214    /// println!();
4215    /// let mut txt = String::new();
4216    /// for c in cipher.clone()
4217    ///     { write!(txt, "{:02X} ", c); }
4218    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
4219    /// 
4220    /// let mut recovered = String::new();
4221    /// tdes.decrypt_vec_into_string(iv, &cipher, &mut recovered);
4222    /// println!("B =\t{}", recovered);
4223    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
4224    /// assert_eq!(recovered, message);
4225    /// ```
4226    /// 
4227    /// ## For more examples,
4228    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_vec_into_string)
4229    #[inline]
4230    fn decrypt_vec_into_string<U>(&mut self, iv: T, cipher: &Vec<U>, message: &mut String) -> u64
4231    where U: SmallUInt + Copy + Clone
4232    {
4233        self.decrypt_into_string(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
4234    }
4235
4236    // fn decrypt_array<U, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: *mut u8) -> u64
4237    /// Decrypts the data stored in an array `[U; N]` object with the padding
4238    /// defined according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode.
4239    /// 
4240    /// # Arguments
4241    /// - `iv` is an initialization vector for PCBC mode.
4242    /// - `cipher` is an immutable reference to an array `[U; N]` object, and
4243    ///   is the place where the plaintext to be decrypted is stored.
4244    /// - `message` is a mutable pointer to `u8` which is `*mut u8`, and
4245    ///   is the place where the decrypted data will be stored.
4246    /// 
4247    /// # Output
4248    /// - This method returns the size of plaintext in bytes.
4249    /// - If this method failed in decryption, it always returns `zero`.
4250    /// - Even if this method succeeded in decryption, it returns `zero` when
4251    ///   the original plaintext is zero-length empty data. Then, you will have
4252    ///   to check whether or not it failed by using the method
4253    ///   `is_successful()` or `is_failed()`.
4254    /// - If `size_of::<U>()` * `N` is greater than `size_of::<T>()`
4255    ///   (which means that the original plaintext is surely not empty data)
4256    ///   and it returns `zero`, you can interpret it that this method surely
4257    ///   failed in decryption.
4258    /// 
4259    /// # Features
4260    /// - You are not encouraged to use this method in pure Rust programming.
4261    ///   Instead, use other safer methods such as decrypt_array_into_*().
4262    /// - This method is useful to use in hybrid programming with C/C++.
4263    /// - `size_of::<U>()` * `N` cannot be other than any multiple
4264    ///   of `size_of::<T>()`.
4265    /// - The size of the memory area which starts at `message` is assumed to
4266    ///   be enough to store the plaintext. So, it is responsible for you to
4267    ///   prepare the `message` area big enough!
4268    /// - The size of the area for plaintext does not have to be prepared more
4269    ///   than `size_of::<U>()` * `N` - `1`.
4270    /// - If the size of the area for plaintext is prepared more than
4271    ///   `size_of::<U>()` * `N` - `1`, the rest of the area will be
4272    ///   filled with `0`s.
4273    /// - The padding bits are composed of the bytes that indicate the length of
4274    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
4275    /// - For more information about the padding bits according to PKCS #7,
4276    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
4277    /// 
4278    /// # For Rijndael or AES, and its variants
4279    /// ## Example 1 for AES-128
4280    /// ```
4281    /// use std::io::Write;
4282    /// use std::fmt::Write as _;
4283    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
4284    /// 
4285    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
4286    /// println!("K =\t{:#016X}", key);
4287    /// let mut a_aes = AES_128::new_with_key_u128(key);
4288    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
4289    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
4290    /// 
4291    /// let message = "In the beginning God created the heavens and the earth.";
4292    /// println!("M =\t{}", message);
4293    /// let mut cipher = [0_u8; 64];
4294    /// a_aes.encrypt_str_into_array(iv.clone(), &message, &mut cipher);
4295    /// print!("C =\t");
4296    /// for c in cipher.clone()
4297    ///     { print!("{:02X} ", c); }
4298    /// println!();
4299    /// let mut txt = String::new();
4300    /// for c in cipher.clone()
4301    ///     { write!(txt, "{:02X} ", c); }
4302    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
4303    /// 
4304    /// let mut recovered = vec![0; 55];
4305    /// a_aes.decrypt_array(iv, &cipher, recovered.as_mut_ptr());
4306    /// print!("Ba =\t");
4307    /// for b in recovered.clone()
4308    ///     { print!("{:02X} ", b); }
4309    /// println!();
4310    /// let mut txt = String::new();
4311    /// for c in recovered.clone()
4312    ///     { write!(txt, "{:02X} ", c); }
4313    /// 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 ");
4314    /// 
4315    /// let mut converted = String::new();
4316    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4317    /// 
4318    /// println!("Bb =\t{}", converted);
4319    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4320    /// assert_eq!(converted, message);
4321    /// ```
4322    /// 
4323    /// ## For more examples,
4324    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_array)
4325    /// 
4326    /// # For DES and its variants
4327    /// ## Example 1 for Normal case
4328    /// ```
4329    /// use std::io::Write;
4330    /// use std::fmt::Write as _;
4331    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
4332    /// 
4333    /// let key = 0x_1234567890ABCDEF_u64;
4334    /// println!("K =\t{:#016X}", key);
4335    /// let mut a_des = DES::new_with_key_u64(key);
4336    ///
4337    /// let message = "In the beginning God created the heavens and the earth.";
4338    /// println!("M =\t{}", message);
4339    /// let iv = 0x_FEDCBA0987654321_u64;
4340    /// println!("IV =	{}", iv);
4341    /// let mut cipher = [0_u8; 56];
4342    /// a_des.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4343    /// print!("C (16 rounds) =\t");
4344    /// for c in cipher.clone()
4345    ///     { print!("{:02X} ", c); }
4346    /// println!();
4347    /// let mut txt = String::new();
4348    /// for c in cipher.clone()
4349    ///     { write!(txt, "{:02X} ", c); }
4350    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
4351    ///
4352    /// let mut recovered = vec![0; 55];
4353    /// let len = a_des.decrypt_array(iv, &cipher, recovered.as_mut_ptr());
4354    /// recovered.truncate(len as usize);
4355    /// print!("Ba (16 rounds) =\t");
4356    /// for b in recovered.clone()
4357    ///     { print!("{:02X} ", b); }
4358    /// println!();
4359    /// let mut txt = String::new();
4360    /// for c in recovered.clone()
4361    ///     { write!(txt, "{:02X} ", c); }
4362    /// 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 ");
4363    ///
4364    /// let mut converted = String::new();
4365    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4366    /// 
4367    /// println!("Bb (16 rounds) =\t{}", converted);
4368    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4369    /// assert_eq!(converted, message);
4370    /// ```
4371    /// 
4372    /// ## For more examples,
4373    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_array)
4374    /// 
4375    /// # For BigCryptor128
4376    /// ## Example 1 for TAES case
4377    /// ```
4378    /// use std::io::Write;
4379    /// use std::fmt::Write as _;
4380    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
4381    /// 
4382    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
4383    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
4384    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
4385    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
4386    /// println!("IV =	{:#034X}", iv);
4387    /// let message = "In the beginning God created the heavens and the earth.";
4388    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 64];
4389    /// taes.encrypt_str_into_array(iv, &message, &mut cipher);
4390    /// print!("C =\t");
4391    /// for c in cipher.clone()
4392    ///     { print!("{:02X} ", c); }
4393    /// println!();
4394    /// let mut txt = String::new();
4395    /// for c in cipher.clone()
4396    ///     { write!(txt, "{:02X} ", c); }
4397    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
4398    /// 
4399    /// let mut recovered = vec![0; 55];
4400    /// let len = taes.decrypt_array(iv, &cipher, recovered.as_mut_ptr());
4401    /// recovered.truncate(len as usize);
4402    /// print!("Ba =\t");
4403    /// for b in recovered.clone()
4404    ///     { print!("{:02X} ", b); }
4405    /// println!();
4406    /// let mut txt = String::new();
4407    /// for c in recovered.clone()
4408    ///     { write!(txt, "{:02X} ", c); }
4409    /// 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 ");
4410    /// 
4411    /// let mut converted = String::new();
4412    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4413    /// 
4414    /// println!("Bb =\t{}", converted);
4415    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4416    /// assert_eq!(converted, message);
4417    /// ```
4418    /// 
4419    /// ## For more examples,
4420    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_array)
4421    /// 
4422    /// # For BigCryptor64
4423    /// ## Example 1 for TDES case
4424    /// ```
4425    /// use std::io::Write;
4426    /// use std::fmt::Write as _;
4427    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
4428    /// 
4429    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
4430    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
4431    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
4432    /// let iv = 0x_FEDCBA0987654321_u64;
4433    /// println!("IV =	{:#018X}", iv);
4434    /// let message = "In the beginning God created the heavens and the earth.";
4435    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 56];
4436    /// tdes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4437    /// print!("C =\t");
4438    /// for c in cipher.clone()
4439    ///     { print!("{:02X} ", c); }
4440    /// println!();
4441    /// let mut txt = String::new();
4442    /// for c in cipher.clone()
4443    ///     { write!(txt, "{:02X} ", c); }
4444    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
4445    /// 
4446    /// let mut recovered = vec![0; 55];
4447    /// let len = tdes.decrypt_array(iv, &cipher, recovered.as_mut_ptr());
4448    /// recovered.truncate(len as usize);
4449    /// print!("Ba =\t");
4450    /// for b in recovered.clone()
4451    ///     { print!("{:02X} ", b); }
4452    /// println!();
4453    /// let mut txt = String::new();
4454    /// for c in recovered.clone()
4455    ///     { write!(txt, "{:02X} ", c); }
4456    /// 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 ");
4457    /// 
4458    /// let mut converted = String::new();
4459    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4460    /// 
4461    /// println!("Bb =\t{}", converted);
4462    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4463    /// assert_eq!(converted, message);
4464    /// ```
4465    /// 
4466    /// ## For more examples,
4467    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_array)
4468    #[inline]
4469    fn decrypt_array<U, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: *mut u8) -> u64
4470    where U: SmallUInt + Copy + Clone
4471    {
4472        self.decrypt(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
4473    }
4474
4475    // fn decrypt_array_into_vec<U, V, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut Vec<V>) -> u64
4476    /// Decrypts the data stored in an array `[U; N]` object with the padding
4477    /// defined according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
4478    /// and stores the decrypted data in `Vec<V>`.
4479    /// 
4480    /// # Arguments
4481    /// - `iv` is an initialization vector for PCBC mode.
4482    /// - `cipher` is an immutable reference to an array `[U; N]` object, and
4483    ///   is the place where the plaintext to be decrypted is stored.
4484    /// - `message` is a mutable reference to `Vec<U>` object, and
4485    ///   is the place where the decrypted data will be stored.
4486    /// 
4487    /// # Output
4488    /// - This method returns the size of plaintext in bytes.
4489    /// - If this method failed in decryption, it always returns `zero`.
4490    /// - Even if this method succeeded in decryption, it returns `zero` when
4491    ///   the original plaintext is zero-length empty data. Then, you will have
4492    ///   to check whether or not it failed by using the method
4493    ///   `is_successful()` or `is_failed()`.
4494    /// - If `size_of::<U>()` * `N` is greater than `size_of::<T>()`
4495    ///   (which means that the original plaintext is surely not empty data)
4496    ///   and it returns `zero`, you can interpret it that this method surely
4497    ///   failed in decryption.
4498    /// 
4499    /// # Features
4500    /// - The padding bits are composed of the bytes that indicate the length of
4501    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
4502    /// - For more information about the padding bits according to PKCS #7,
4503    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
4504    /// - You don't have to worry about whether or not the size of the memory
4505    ///   area where the ciphertext will be stored is enough.
4506    /// 
4507    /// # For Rijndael or AES, and its variants
4508    /// ## Example 1 for AES-128
4509    /// ```
4510    /// use std::io::Write;
4511    /// use std::fmt::Write as _;
4512    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
4513    /// 
4514    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
4515    /// println!("K =\t{:#016X}", key);
4516    /// let mut a_aes = AES_128::new_with_key_u128(key);
4517    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
4518    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
4519    /// 
4520    /// let message = "In the beginning God created the heavens and the earth.";
4521    /// println!("M =\t{}", message);
4522    /// let mut cipher = [0_u8; 64];
4523    /// a_aes.encrypt_str_into_array(iv.clone(), &message, &mut cipher);
4524    /// print!("C =\t");
4525    /// for c in cipher.clone()
4526    ///     { print!("{:02X} ", c); }
4527    /// println!();
4528    /// let mut txt = String::new();
4529    /// for c in cipher.clone()
4530    ///     { write!(txt, "{:02X} ", c); }
4531    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
4532    /// 
4533    /// let mut recovered = vec![0; 55];
4534    /// a_aes.decrypt_array_into_vec(iv, &cipher, &mut recovered);
4535    /// print!("Ba =\t");
4536    /// for b in recovered.clone()
4537    ///     { print!("{:02X} ", b); }
4538    /// println!();
4539    /// let mut txt = String::new();
4540    /// for c in recovered.clone()
4541    ///     { write!(txt, "{:02X} ", c); }
4542    /// 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 ");
4543    /// 
4544    /// let mut converted = String::new();
4545    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4546    /// 
4547    /// println!("Bb =\t{}", converted);
4548    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4549    /// assert_eq!(converted, message);
4550    /// ```
4551    /// 
4552    /// ## For more examples,
4553    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_array_into_vec)
4554    /// 
4555    /// # For DES and its variants
4556    /// ## Example 1 for Normal case
4557    /// ```
4558    /// use std::io::Write;
4559    /// use std::fmt::Write as _;
4560    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
4561    /// 
4562    /// let key = 0x_1234567890ABCDEF_u64;
4563    /// println!("K =\t{:#016X}", key);
4564    /// let mut a_des = DES::new_with_key_u64(key);
4565    ///
4566    /// let message = "In the beginning God created the heavens and the earth.";
4567    /// println!("M =\t{}", message);
4568    /// let iv = 0x_FEDCBA0987654321_u64;
4569    /// println!("IV =	{}", iv);
4570    /// let mut cipher = [0_u8; 56];
4571    /// a_des.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4572    /// print!("C (16 rounds) =\t");
4573    /// for c in cipher.clone()
4574    ///     { print!("{:02X} ", c); }
4575    /// println!();
4576    /// let mut txt = String::new();
4577    /// for c in cipher.clone()
4578    ///     { write!(txt, "{:02X} ", c); }
4579    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
4580    ///
4581    /// let mut recovered = Vec::<u8>::new();
4582    /// a_des.decrypt_array_into_vec(iv, &cipher, &mut recovered);
4583    /// print!("Ba (16 rounds) =\t");
4584    /// for b in recovered.clone()
4585    ///     { print!("{:02X} ", b); }
4586    /// println!();
4587    /// let mut txt = String::new();
4588    /// for c in recovered.clone()
4589    ///     { write!(txt, "{:02X} ", c); }
4590    /// 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 ");
4591    ///
4592    /// let mut converted = String::new();
4593    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4594    /// 
4595    /// println!("Bb (16 rounds) =\t{}", converted);
4596    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4597    /// assert_eq!(converted, message);
4598    /// ```
4599    /// 
4600    /// ## For more examples,
4601    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_array_into_vec)
4602    /// 
4603    /// # For BigCryptor128
4604    /// ## Example 1 for TAES case
4605    /// ```
4606    /// use std::io::Write;
4607    /// use std::fmt::Write as _;
4608    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
4609    /// 
4610    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
4611    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
4612    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
4613    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
4614    /// println!("IV =	{:#034X}", iv);
4615    /// let message = "In the beginning God created the heavens and the earth.";
4616    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 64];
4617    /// taes.encrypt_str_into_array(iv, &message, &mut cipher);
4618    /// print!("C =\t");
4619    /// for c in cipher.clone()
4620    ///     { print!("{:02X} ", c); }
4621    /// println!();
4622    /// let mut txt = String::new();
4623    /// for c in cipher.clone()
4624    ///     { write!(txt, "{:02X} ", c); }
4625    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
4626    /// 
4627    /// let mut recovered = Vec::<u8>::new();
4628    /// taes.decrypt_array_into_vec(iv, &cipher, &mut recovered);
4629    /// print!("Ba =\t");
4630    /// for b in recovered.clone()
4631    ///     { print!("{:02X} ", b); }
4632    /// println!();
4633    /// let mut txt = String::new();
4634    /// for c in recovered.clone()
4635    ///     { write!(txt, "{:02X} ", c); }
4636    /// 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 ");
4637    /// 
4638    /// let mut converted = String::new();
4639    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4640    /// 
4641    /// println!("Bb =\t{}", converted);
4642    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4643    /// assert_eq!(converted, message);
4644    /// ```
4645    /// 
4646    /// ## For more examples,
4647    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_array_into_vec)
4648    /// 
4649    /// # For BigCryptor64
4650    /// ## Example 1 for TDES case
4651    /// ```
4652    /// use std::io::Write;
4653    /// use std::fmt::Write as _;
4654    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
4655    /// 
4656    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
4657    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
4658    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
4659    /// let iv = 0x_FEDCBA0987654321_u64;
4660    /// println!("IV =	{:#018X}", iv);
4661    /// let message = "In the beginning God created the heavens and the earth.";
4662    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 56];
4663    /// tdes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4664    /// print!("C =\t");
4665    /// for c in cipher.clone()
4666    ///     { print!("{:02X} ", c); }
4667    /// println!();
4668    /// let mut txt = String::new();
4669    /// for c in cipher.clone()
4670    ///     { write!(txt, "{:02X} ", c); }
4671    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
4672    /// 
4673    /// let mut recovered = Vec::<u8>::new();
4674    /// tdes.decrypt_array_into_vec(iv, &cipher, &mut recovered);
4675    /// print!("Ba =\t");
4676    /// for b in recovered.clone()
4677    ///     { print!("{:02X} ", b); }
4678    /// println!();
4679    /// let mut txt = String::new();
4680    /// for c in recovered.clone()
4681    ///     { write!(txt, "{:02X} ", c); }
4682    /// 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 ");
4683    /// 
4684    /// let mut converted = String::new();
4685    /// unsafe { converted.as_mut_vec() }.append(&mut recovered);
4686    /// 
4687    /// println!("Bb =\t{}", converted);
4688    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4689    /// assert_eq!(converted, message);
4690    /// ```
4691    /// 
4692    /// ## For more examples,
4693    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_array_into_vec)
4694    #[inline]
4695    fn decrypt_array_into_vec<U, V, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut Vec<V>) -> u64
4696    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
4697    {
4698        self.decrypt_into_vec(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
4699    }
4700
4701    // fn decrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut [V; M]) -> u64
4702    /// Decrypts the data stored in an array `[U; N]` object with the padding
4703    /// defined according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
4704    /// and stores the decrypted data in array `[V; M]`.
4705    /// 
4706    /// # Arguments
4707    /// - `iv` is an initialization vector for PCBC mode.
4708    /// - `cipher` is an immutable reference to an array `[U; N]` object, and
4709    ///   is the place where the plaintext to be decrypted is stored.
4710    /// - `message` is a mutable reference to an array `[U; N]` object, and
4711    ///   is the place where the decrypted data will be stored.
4712    /// 
4713    /// # Output
4714    /// - This method returns the size of plaintext in bytes.
4715    /// - If this method failed in decryption, it always returns `zero`.
4716    /// - Even if this method succeeded in decryption, it returns `zero` when
4717    ///   the original plaintext is zero-length empty data. Then, you will have
4718    ///   to check whether or not it failed by using the method
4719    ///   `is_successful()` or `is_failed()`.
4720    /// - If `size_of::<U>()` * `N` is greater than `size_of::<T>()`
4721    ///   (which means that the original plaintext is surely not empty data)
4722    ///   and it returns `zero`, you can interpret it that this method surely
4723    ///   failed in decryption.
4724    /// 
4725    /// # Features
4726    /// - If `size_of::<V>()` * `M` is less than 
4727    ///   `size_of::<U>()` * `N` - `1`, this method does not perform
4728    ///   decryption but returns `zero`.
4729    /// - If `size_of::<V>()` * `M` is equal to or greater than
4730    ///   `size_of::<U>()` * `N` - `1`, this method performs decryption,
4731    ///   fills the array `message` with the decrypted data, and then
4732    ///   fills the rest of the elements of the array `message` with zeros, and
4733    ///   returns the size of the plaintext.
4734    /// - It is responsible for you to prepare the `message` area big enough!
4735    /// - The size of the area for plaintext does not have to be prepared more
4736    ///   than `size_of::<U>()` * `N` - `1`.
4737    /// - The padding bits are composed of the bytes that indicate the length of
4738    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
4739    /// - For more information about the padding bits according to PKCS #7,
4740    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
4741    /// 
4742    /// # For Rijndael or AES, and its variants
4743    /// ## Example 1 for AES-128
4744    /// ```
4745    /// use std::io::Write;
4746    /// use std::fmt::Write as _;
4747    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
4748    /// 
4749    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
4750    /// println!("K =\t{:#016X}", key);
4751    /// let mut a_aes = AES_128::new_with_key_u128(key);
4752    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
4753    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
4754    /// 
4755    /// let message = "In the beginning God created the heavens and the earth.";
4756    /// println!("M =\t{}", message);
4757    /// let mut cipher = [0_u8; 64];
4758    /// a_aes.encrypt_str_into_array(iv.clone(), &message, &mut cipher);
4759    /// print!("C =\t");
4760    /// for c in cipher.clone()
4761    ///     { print!("{:02X} ", c); }
4762    /// println!();
4763    /// let mut txt = String::new();
4764    /// for c in cipher.clone()
4765    ///     { write!(txt, "{:02X} ", c); }
4766    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
4767    /// 
4768    /// let mut recovered = [0; 64];
4769    /// let len = a_aes.decrypt_array_into_array(iv, &cipher, &mut recovered);
4770    /// print!("Ba =\t");
4771    /// for b in recovered.clone()
4772    ///     { print!("{:02X} ", b); }
4773    /// println!();
4774    /// let mut txt = String::new();
4775    /// for c in recovered.clone()
4776    ///     { write!(txt, "{:02X} ", c); }
4777    /// 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 00 00 00 00 00 00 00 00 ");
4778    /// 
4779    /// let mut converted = String::new();
4780    /// unsafe { converted.as_mut_vec() }.write(&recovered);
4781    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
4782    /// println!("Bb =\t{}", converted);
4783    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4784    /// assert_eq!(converted, message);
4785    /// ```
4786    /// 
4787    /// ## For more examples,
4788    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_array_into_array)
4789    /// 
4790    /// # For DES and its variants
4791    /// ## Example 1 for Normal case
4792    /// ```
4793    /// use std::io::Write;
4794    /// use std::fmt::Write as _;
4795    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
4796    /// 
4797    /// let key = 0x_1234567890ABCDEF_u64;
4798    /// println!("K =\t{:#016X}", key);
4799    /// let mut a_des = DES::new_with_key_u64(key);
4800    ///
4801    /// let message = "In the beginning God created the heavens and the earth.";
4802    /// println!("M =\t{}", message);
4803    /// let iv = 0x_FEDCBA0987654321_u64;
4804    /// println!("IV =	{}", iv);
4805    /// let mut cipher = [0_u8; 56];
4806    /// a_des.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4807    /// print!("C (16 rounds) =\t");
4808    /// for c in cipher.clone()
4809    ///     { print!("{:02X} ", c); }
4810    /// println!();
4811    /// let mut txt = String::new();
4812    /// for c in cipher.clone()
4813    ///     { write!(txt, "{:02X} ", c); }
4814    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
4815    ///
4816    /// let mut recovered = [0u8; 56];
4817    /// let len = a_des.decrypt_array_into_array(iv, &cipher, &mut recovered);
4818    /// print!("Ba (16 rounds) =\t");
4819    /// for b in recovered.clone()
4820    ///     { print!("{:02X} ", b); }
4821    /// println!();
4822    /// let mut txt = String::new();
4823    /// for c in recovered.clone()
4824    ///     { write!(txt, "{:02X} ", c); }
4825    /// 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 ");
4826    ///
4827    /// let mut converted = String::new();
4828    /// unsafe { converted.as_mut_vec() }.write(&recovered);
4829    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
4830    /// println!("Bb (16 rounds) =\t{}", converted);
4831    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4832    /// assert_eq!(converted, message);
4833    /// ```
4834    /// 
4835    /// ## For more examples,
4836    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_array_into_array)
4837    /// 
4838    /// # For BigCryptor128
4839    /// ## Example 1 for TAES case
4840    /// ```
4841    /// use std::io::Write;
4842    /// use std::fmt::Write as _;
4843    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
4844    /// 
4845    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
4846    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
4847    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
4848    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
4849    /// println!("IV =	{:#034X}", iv);
4850    /// let message = "In the beginning God created the heavens and the earth.";
4851    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 64];
4852    /// taes.encrypt_str_into_array(iv, &message, &mut cipher);
4853    /// print!("C =\t");
4854    /// for c in cipher.clone()
4855    ///     { print!("{:02X} ", c); }
4856    /// println!();
4857    /// let mut txt = String::new();
4858    /// for c in cipher.clone()
4859    ///     { write!(txt, "{:02X} ", c); }
4860    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
4861    /// 
4862    /// let mut recovered = [0u8; 64];
4863    /// let len = taes.decrypt_array_into_array(iv, &cipher, &mut recovered);
4864    /// print!("Ba =\t");
4865    /// for b in recovered.clone()
4866    ///     { print!("{:02X} ", b); }
4867    /// println!();
4868    /// let mut txt = String::new();
4869    /// for c in recovered.clone()
4870    ///     { write!(txt, "{:02X} ", c); }
4871    /// 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 00 00 00 00 00 00 00 00 ");
4872    /// 
4873    /// let mut converted = String::new();
4874    /// unsafe { converted.as_mut_vec() }.write(&recovered);
4875    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
4876    /// println!("Bb =\t{}", converted);
4877    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4878    /// assert_eq!(converted, message);
4879    /// ```
4880    /// 
4881    /// ## For more examples,
4882    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_array_into_array)
4883    /// 
4884    /// # For BigCryptor64
4885    /// ## Example 1 for TDES case
4886    /// ```
4887    /// use std::io::Write;
4888    /// use std::fmt::Write as _;
4889    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
4890    /// 
4891    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
4892    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
4893    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
4894    /// let iv = 0x_FEDCBA0987654321_u64;
4895    /// println!("IV =	{:#018X}", iv);
4896    /// let message = "In the beginning God created the heavens and the earth.";
4897    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 56];
4898    /// tdes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
4899    /// print!("C =\t");
4900    /// for c in cipher.clone()
4901    ///     { print!("{:02X} ", c); }
4902    /// println!();
4903    /// let mut txt = String::new();
4904    /// for c in cipher.clone()
4905    ///     { write!(txt, "{:02X} ", c); }
4906    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
4907    /// 
4908    /// let mut recovered = [0u8; 56];
4909    /// let len = tdes.decrypt_array_into_array(iv, &cipher, &mut recovered);
4910    /// print!("Ba =\t");
4911    /// for b in recovered.clone()
4912    ///     { print!("{:02X} ", b); }
4913    /// println!();
4914    /// let mut txt = String::new();
4915    /// for c in recovered.clone()
4916    ///     { write!(txt, "{:02X} ", c); }
4917    /// 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 ");
4918    /// 
4919    /// let mut converted = String::new();
4920    /// unsafe { converted.as_mut_vec() }.write(&recovered);
4921    /// unsafe { converted.as_mut_vec() }.truncate(len as usize);
4922    /// println!("Bb =\t{}", converted);
4923    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
4924    /// assert_eq!(converted, message);
4925    /// ```
4926    /// 
4927    /// ## For more examples,
4928    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_array_into_array)
4929    #[inline]
4930    fn decrypt_array_into_array<U, V, const N: usize, const M: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut [V; M]) -> u64
4931    where U: SmallUInt + Copy + Clone, V: SmallUInt + Copy + Clone
4932    {
4933        self.decrypt_into_array(iv, cipher.as_ptr() as *const u8, (N as u32 * U::size_in_bytes()) as u64, message)
4934    }
4935
4936    // fn decrypt_array_into_string<U, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut String) -> u64
4937    /// Decrypts the data stored in an array `[U; N]` object with the padding
4938    /// defined according to PKCS #7 in PCBC (Propagation Cipher-Block Chaining) mode,
4939    /// and stores the decrypted data in `String`.
4940    /// 
4941    /// # Arguments
4942    /// - `iv` is an initialization vector for PCBC mode.
4943    /// - `cipher` is an immutable reference to an array `[U; N]` object, and
4944    ///   is the place where the plaintext to be decrypted is stored.
4945    /// - `message` is a mutable reference to a `String` object, and
4946    ///   is the place where the decrypted data will be stored.
4947    /// 
4948    /// # Output
4949    /// - This method returns the size of plaintext in bytes.
4950    /// - If this method failed in decryption, it always returns `zero`.
4951    /// - Even if this method succeeded in decryption, it returns `zero` when
4952    ///   the original plaintext is zero-length empty data. Then, you will have
4953    ///   to check whether or not it failed by using the method
4954    ///   `is_successful()` or `is_failed()`.
4955    /// - If `size_of::<U>()` * `N` is greater than `size_of::<T>()`
4956    ///   (which means that the original plaintext is surely not empty data)
4957    ///   and it returns `zero`, you can interpret it that this method surely
4958    ///   failed in decryption.
4959    /// 
4960    /// # Features
4961    /// - The padding bits are composed of the bytes that indicate the length of
4962    ///   the padding bits in bytes according to PKCS #7 defined in RFC 5652.
4963    /// - For more information about the padding bits according to PKCS #7,
4964    ///   Read [here](https://node-security.com/posts/cryptography-pkcs-7-padding/).
4965    /// - You don't have to worry about whether or not the size of the memory
4966    ///   area where the ciphertext will be stored is enough.
4967    /// - This method assumes that the original plaintext is a string
4968    ///   in the format of UTF-8.
4969    /// 
4970    /// # For Rijndael or AES, and its variants
4971    /// ## Example 1 for AES-128
4972    /// ```
4973    /// use std::io::Write;
4974    /// use std::fmt::Write as _;
4975    /// use cryptocol::symmetric::{ AES_128, PCBC_PKCS7 };
4976    /// 
4977    /// let key = 0x_1234567890ABCDEF1234567890ABCDEF_u128;
4978    /// println!("K =\t{:#016X}", key);
4979    /// let mut a_aes = AES_128::new_with_key_u128(key);
4980    /// let iv = [0x87654321_u32, 0xFEDCBA09_u32, 0x87654321_u32, 0xFEDCBA09_u32];
4981    /// println!("IV =\t{:08X}{:08X}{:08X}{:08X}", iv[0].to_be(), iv[1].to_be(), iv[2].to_be(), iv[3].to_be());
4982    /// 
4983    /// let message = "In the beginning God created the heavens and the earth.";
4984    /// println!("M =\t{}", message);
4985    /// let mut cipher = [0_u8; 64];
4986    /// a_aes.encrypt_str_into_array(iv.clone(), &message, &mut cipher);
4987    /// print!("C =\t");
4988    /// for c in cipher.clone()
4989    ///     { print!("{:02X} ", c); }
4990    /// println!();
4991    /// let mut txt = String::new();
4992    /// for c in cipher.clone()
4993    ///     { write!(txt, "{:02X} ", c); }
4994    /// assert_eq!(txt, "C9 1C 27 CE 83 92 A1 CF 7D A4 64 35 16 48 01 72 EC 7B 5E 0B F6 7C AB 84 BB DD 0F 27 F4 63 B5 E3 C2 1D 11 06 C2 BF B0 32 24 81 DB FD A4 CE 56 F6 0B 49 DD 7A 22 C9 C8 91 34 F6 0A 3A E7 C1 59 7A ");
4995    /// 
4996    /// let mut converted = String::new();
4997    /// a_aes.decrypt_array_into_string(iv, &cipher, &mut converted);
4998    /// println!("B =\t{}", converted);
4999    /// assert_eq!(converted, "In the beginning God created the heavens and the earth.");
5000    /// assert_eq!(converted, message);
5001    /// ```
5002    /// 
5003    /// ## For more examples,
5004    /// click [here](./documentation/rijndael_pcbc_pkcs7/struct.Rijndal_Generic.html#method.decrypt_array_into_string)
5005    /// 
5006    /// # For DES and its variants
5007    /// ## Example 1 for Normal case
5008    /// ```
5009    /// use std::io::Write;
5010    /// use std::fmt::Write as _;
5011    /// use cryptocol::symmetric::{ DES, PCBC_PKCS7 };
5012    /// 
5013    /// let key = 0x_1234567890ABCDEF_u64;
5014    /// println!("K =\t{:#016X}", key);
5015    /// let mut a_des = DES::new_with_key_u64(key);
5016    ///
5017    /// let message = "In the beginning God created the heavens and the earth.";
5018    /// println!("M =\t{}", message);
5019    /// let iv = 0x_FEDCBA0987654321_u64;
5020    /// println!("IV =	{}", iv);
5021    /// let mut cipher = [0_u8; 56];
5022    /// a_des.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
5023    /// print!("C (16 rounds) =\t");
5024    /// for c in cipher.clone()
5025    ///     { print!("{:02X} ", c); }
5026    /// println!();
5027    /// let mut txt = String::new();
5028    /// for c in cipher.clone()
5029    ///     { write!(txt, "{:02X} ", c); }
5030    /// assert_eq!(txt, "4B B5 ED DC A0 58 7E 6D DB B4 41 7D 93 0B BD CD 0E B8 80 D4 EC 13 FC 57 D6 7E FF 69 1C 76 8A CD A1 A6 77 7C 6E 86 28 21 DD DB 59 0C 72 39 9B 95 01 BB EE 98 FC B6 40 01 ");
5031    ///
5032    /// let mut recovered = String::new();
5033    /// a_des.decrypt_array_into_string(iv, &cipher, &mut recovered);
5034    /// println!("B (16 rounds) =\t{}", recovered);
5035    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
5036    /// assert_eq!(recovered, message);
5037    /// ```
5038    /// 
5039    /// ## For more examples,
5040    /// click [here](./documentation/des_pcbc_pkcs7/struct.DES_Generic.html#method.decrypt_array_into_string)
5041    /// 
5042    /// # For BigCryptor128
5043    /// ## Example 1 for TAES case
5044    /// ```
5045    /// use std::io::Write;
5046    /// use std::fmt::Write as _;
5047    /// use cryptocol::symmetric::{ BigCryptor128, AES_128, PCBC_PKCS7 };
5048    /// 
5049    /// let mut taes = AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128)
5050    ///                 + AES_128::decryptor_with_key_u128(0x_FEDCBA09876543211234567890ABCDEF_u128)
5051    ///                 + AES_128::encryptor_with_key_u128(0x_1234567890ABCDEFFEDCBA0987654321_u128);
5052    /// let iv = 0x_FEDCBA09876543211234567890ABCDEF_u128;
5053    /// println!("IV =	{:#034X}", iv);
5054    /// let message = "In the beginning God created the heavens and the earth.";
5055    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 64];
5056    /// taes.encrypt_str_into_array(iv, &message, &mut cipher);
5057    /// print!("C =\t");
5058    /// for c in cipher.clone()
5059    ///     { print!("{:02X} ", c); }
5060    /// println!();
5061    /// let mut txt = String::new();
5062    /// for c in cipher.clone()
5063    ///     { write!(txt, "{:02X} ", c); }
5064    /// assert_eq!(txt, "87 B7 B0 67 C9 41 CF C6 CF B8 69 0D 39 D3 9B EC E2 3A 60 04 1D 95 41 45 BA B6 1F 41 67 F0 72 03 83 D8 7B 9D 64 CC BD A6 BF C2 DB AA E9 38 97 B7 A9 7B 95 FD 5D 9F 65 ED 00 8F 80 79 C7 C0 41 5C ");
5065    /// 
5066    /// let mut recovered = String::new();
5067    /// taes.decrypt_array_into_string(iv, &cipher, &mut recovered);
5068    /// println!("B =\t{}", recovered);
5069    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
5070    /// assert_eq!(recovered, message);
5071    /// ```
5072    /// 
5073    /// ## For more examples,
5074    /// click [here](./documentation/big_cryptor128_pcbc_pkcs7/struct.BigCryptor128.html#method.decrypt_array_into_string)
5075    /// 
5076    /// # For BigCryptor64
5077    /// ## Example 1 for TDES case
5078    /// ```
5079    /// use std::io::Write;
5080    /// use std::fmt::Write as _;
5081    /// use cryptocol::symmetric::{ BigCryptor64, DES, PCBC_PKCS7 };
5082    /// 
5083    /// let mut tdes = DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64)
5084    ///                 + DES::decryptor_with_key_u64(0x_FEDCBA0987654321_u64)
5085    ///                 + DES::encryptor_with_key_u64(0x_1234567890ABCDEF_u64);
5086    /// let iv = 0x_FEDCBA0987654321_u64;
5087    /// println!("IV =	{:#018X}", iv);
5088    /// let message = "In the beginning God created the heavens and the earth.";
5089    /// println!("M =\t{}", message);    let mut cipher = [0_u8; 56];
5090    /// tdes.encrypt_into_array(iv, message.as_ptr(), message.len() as u64, &mut cipher);
5091    /// print!("C =\t");
5092    /// for c in cipher.clone()
5093    ///     { print!("{:02X} ", c); }
5094    /// println!();
5095    /// let mut txt = String::new();
5096    /// for c in cipher.clone()
5097    ///     { write!(txt, "{:02X} ", c); }
5098    /// assert_eq!(txt, "01 A5 7E BC ED 83 28 FB DD AC 7F 93 37 1B A6 28 89 A6 19 D3 9E E6 A0 29 B6 EA 99 D9 D1 F1 F0 E4 9D 54 E9 55 2B FD 40 DA B7 B3 3D 5F 86 2D 30 BF B2 28 DD A3 42 A4 70 06 ");
5099    /// 
5100    /// let mut recovered = String::new();
5101    /// tdes.decrypt_array_into_string(iv, &cipher, &mut recovered);
5102    /// println!("B =\t{}", recovered);
5103    /// assert_eq!(recovered, "In the beginning God created the heavens and the earth.");
5104    /// assert_eq!(recovered, message);
5105    /// ```
5106    /// 
5107    /// ## For more examples,
5108    /// click [here](./documentation/big_cryptor64_pcbc_pkcs7/struct.BigCryptor64.html#method.decrypt_array_into_string)
5109    #[inline]
5110    fn decrypt_array_into_string<U, const N: usize>(&mut self, iv: T, cipher: &[U; N], message: &mut String) -> u64
5111    where U: SmallUInt + Copy + Clone
5112    {
5113        self.decrypt_into_string(iv, cipher.as_ptr() as *const u8, (cipher.len() as u32 * U::size_in_bytes()) as u64, message)
5114    }
5115}