cryptocol/
lib.rs

1// Copyright 2023, 2024 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#![warn(missing_docs)]
10// #![warn(rustdoc::missing_doc_code_examples)]
11
12//! cryptocol crate provides libraries for cryptography.
13//! 
14//! This crate is optimized for Little-endian CPUs because Little-Endian CPUs
15//! are far more popular than Big-endian CPUs. For the information about
16//! Endianness (including Little-endian and Big-endian)
17//! [Read more](https://en.wikipedia.org/wiki/Endianness).
18//! 
19//! # Big-endian issue
20//! This crate is just experimental for Big-endian CPUs. So, you are not
21//! encouraged to use this crate for Big-endian CPUs for serious purpose.
22//! Only use this crate for Big-endian CPUs with your own full responsibility.
23//! 
24//! # Road Map for Version 1.0
25//! This crate Cryptocol is planned to provide the following functionalities.
26//! The checked items have already been implemented including documentation
27//! at least 95%. The unchecked items have been implemented including
28//! documentation less than 95% or have not yet even been started to implement.
29//! 
30//! ## Small Numbers: meaningful as itself, and also foundations mainly for Big Numbers as well as for other modules
31//! - [X] Unions for primitive data types and their implementation, and the
32//!       implementation of trait SmallUInt for the Unions ---
33//!     [`ShortUnion`](number/short_union/union.ShortUnion.html#union.ShortUnion),
34//!     [`IntUnion`](number/int_union/union.IntUnion.html#union.IntUnion),
35//!     [`LongUnion`](number/long_union/union.LongUnion.html#union.LongUnion),
36//!     [`LongerUnion`](number/longer_union/union.LongerUnion.html#union.LongerUnion),
37//!     [`SizeUnion`](number/size_union/union.SizeUnion.html#union.SizeUnion),
38//!     [`SharedValues`](number/shared_values/union.SharedValues.html#union.SharedValues), and
39//!     [`SharedArrays`](number/shared_arrays/union.SharedArrays.html#union.SharedArrays)
40//! - [X] Trait SmallUInt, its implementation for primitive data types, and the
41//!       implementation of it for the Unions ---
42//!     [`SmallUInt`](number/small_uint/trait.SmallUInt.html#trait.SmallUInt)
43// ! - [ ] Trait SmallSInt, its implementation for primitive data types, and the
44// !       implementation of it for the Unions ---
45// !    [`SmallSInt`](number/small_sint/trait.SmallSInt.html#trait.SmallSInt)
46// !     _--> Thinking about postponing to Roadmap for ver. 2.0_
47//! 
48//! ## Big Numbers: meaningful as itself and also the foundation for Asymmetric-Key Algorithms
49//! - [X] Fixed Sized Big Unsigned Integer Operation --- You can find most of
50//!       the methods you need for big integer calculation at
51//!       [`BigUInt`](number/big_uint/struct.BigUInt.html#struct.BigUInt).
52//! - [X] Auxiliary Fixed Sized Big Unsigned Integer Operations --- If you don't
53//!       find what you need at
54//!       [`BigUInt`](number/big_uint/struct.BigUInt.html#struct.BigUInt),
55//!       you may find it at
56//!       [`BigUInt_More`](number/trait_big_uint_more/trait.BigUInt_More.html#trait.BigUInt_More).
57//!       You can't find modular-related methods at
58//!       [`BigUInt`](number/big_uint/struct.BigUInt.html#struct.BigUInt),
59//!       but you may find them at
60//!       [`BigUInt_Modular`](number/trait_big_uint_modular/trait.BigUInt_Modular.html#trait.BigUInt_Modular).
61//!       You can't find panic-free-releated methods at
62//!       [`BigUInt`](number/big_uint/struct.BigUInt.html#struct.BigUInt),
63//!       but you may find it at
64//!       [`BigUInt_Panic_Free`](number/trait_big_uint_panic_free/trait.BigUInt_Panic_Free.html#trait.BigUInt_Panic_Free).
65//!       You can't find prime number-related methods at
66//!       [`BigUInt`](number/big_uint/struct.BigUInt.html#struct.BigUInt),
67//!       you may find it at
68//!       [`BigUInt_Prime`](number/trait_big_uint_prime/trait.BigUInt_Prime.html#trait.BigUInt_Prime).
69// ! - [ ] Fixed Sized Big Signed Integer Operation --- BigSInt
70// !    _--> Thinking about postponing to Roadmap for ver. 2.0_
71// ! - [ ] Variable Sized Big Signed Integer Operation --- LargeInt
72// !    _--> Thinking about postponing to Roadmap for ver. 2.0 or higher_
73//! 
74//! ## Hash Algorithms
75// ! - [ ] MD2 hash algorithms based on 128 bits
76// !       --- Includes MD4 and its expanded versions.
77// !       ===> Moved to Roadmap for ver. 2.0
78//! - [X] MD4 hash algorithms based on 128 bits
79//!       --- Includes MD4 and its expanded versions.
80//!       [`MD4_Generic`](hash/md4/struct.MD4_Generic.html#struct.MD4_Generic)
81//! - [X] MD5 hash algorithms based on 128 bits
82//!       --- Includes MD5 and its expanded versions.
83//!       [`MD5_Generic`](hash/md5/struct.MD5_Generic.html#struct.MD5_Generic)
84// ! - [ ] MD6 hash algorithms based on 256 bits
85// !       --- Includes MD4 and its expanded versions.
86// !       ===> Moved to Roadmap for ver. 2.0
87//! - [X] SHA-1 hash algorithms based on 160 bits
88//!       --- Includes SHA-1, SHA-0, and their expanded versions.
89//!       [`SHA1_Generic`](hash/sha1/struct.SHA1_Generic.html#struct.SHA1_Generic)
90//! - [X] SHA-2 hash algorithms based on 256 bits
91//!       --- Includes SHA-256, SHA-224, and their expanded versions.
92//!       [`SHA2_256_Generic`](hash/sha2_256/struct.SHA2_256_Generic.html#struct.SHA2_256_Generic)
93//! - [X] SHA-2 hash algorithms based on 512 bits
94//!       --- Includes SHA-512, SHA-384, SHA-512/256, and their expanded versions.
95//!       [`SHA2_512_Generic`](hash/sha2_512/struct.SHA2_512_Generic.html#struct.SHA2_512_Generic)
96//! - [X] SHA-2 hash algorithms based on 512/t bits
97//!       --- Includes 512/256, SHA-512/224, and their expanded versions.
98//!       [`SHA2_512_t_Generic`](hash/sha2_512_t/struct.SHA2_512_t_Generic.html#struct.SHA2_512_t_Generic)
99//! - [ ] SHA-3 and Keccak hash algorithms based on 8/16/32/64 bits
100//!       --- Includes SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE 128, SHAKE 256, cSHAKE-128, cSHAKE-256, Keccak family and their expanded versions.
101//!       [`Keccak_Generic`](https://docs.rs/cryptocol/latest/cryptocol/hash/keccak/struct.Keccak_Generic.html#struct.Keccak_Generic)
102// ! - [ ] RIPEMD hash algorithms based on 256 bits
103// !       --- Includes RIPEMD and its expanded versions.
104// !       ===> Moved to Roadmap for ver. 2.0
105// ! - [ ] BLAKE2 hash algorithms based on 256 bits
106// !       --- Includes BLAKE2 and its expanded versions.
107// !       ===> Moved to Roadmap for ver. 2.0
108// ! - [ ] BLAKE3 hash algorithms based on 256 bits
109// !       --- Includes BLAKE3 and its expanded versions.
110// !       ===> Moved to Roadmap for ver. 2.0
111//! 
112//! ## Symmetric-key Algorithms for the Encryption/Decryption of digital data
113// ! - [ ] Lucifer symmetric-key encryption/decryption algorithm
114// !       --- Includes Lucifer and its expanded versions. `Lucifer_Generic`
115// !       ===> Moved to Roadmap for ver. 2.0
116//! - [X] DES symmetric-key encryption/decryption algorithm and the traits and its implementations of Operation modes and padding bits for DES_Generic
117//!       --- Includes DES and its expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits
118//!       according to PKCS#7 and ISO 7816-4.
119//!       [`DES_Generic`](symmetric/des/struct.DES_Generic.html#struct.DES_Generic)
120//!       [`ECB_PKCS7`](symmetric/trait.ECB_PKCS7.html#trait.ECB_PKCS7),
121//!       [`ECB_ISO`](symmetric/trait.ECB_ISO.html#trait.ECB_ISO),
122//!       [`CBC_PKCS7`](symmetric/trait.CBC_PKCS7.html#trait.CBC_PKCS7),
123//!       [`CBC_ISO`](symmetric/trait.CBC_ISO.html#trait.CBC_ISO),
124//!       [`PCBC_PKCS7`](symmetric/trait.PCBC_PKCS7.html#trait.PCBC_PKCS7),
125//!       [`PCBC_ISO`](symmetric/trait.PCBC_ISO.html#trait.PCBC_ISO),
126//!       [`CFB`](symmetric/trait.CFB.html#trait.CFB),
127//!       [`OFB`](symmetric/trait.OFB.html#trait.OFB), and
128//!       [`CTR`](symmetric/trait.CTR.html#trait.CTR).
129//! - [ ] AES symmetric-key encryption/decryption algorithm and the trait implementations of Operation modes and padding bits for AES_Generic
130//!       --- Includes AES and its expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits
131//!       according to PKCS#7 and ISO 7816-4.
132//!       `AES_Generic`, `ECB_PKCS7`, `ECB_ISO`, `CBC_PKCS7`, `CBC_ISO`, `PCBC_PKCS7`, `PCBC_ISO`, `CFB`, `OFB`, and `CTR`.
133// ! (symmetric/aes/struct.AES_Generic.html#struct.AES_Generic)
134//! - [ ] Bluefish symmetric-key encryption/decryption algorithm
135// !     --- Includes Bluefish and its expanded versions. `Bluefish_Generic`
136// !     ===> Moved to Roadmap for ver. 2.0
137// ! - [ ] Twofish symmetric-key encryption/decryption algorithm
138// !     --- Includes Twofish and its expanded versions. `Twofish_Generic`
139// !     ===> Moved to Roadmap for ver. 2.0
140// ! - [ ] SEED symmetric-key encryption/decryption algorithm
141// !     --- Includes SEED and its expanded versions. `SEED_Generic`
142// !     ===> Moved to Roadmap for ver. 2.0
143// ! - [ ] HIGHT symmetric-key encryption/decryption algorithm
144// !     --- Includes HIGHT and its expanded versions. `HIGHT_Generic`
145// !     ===> Moved to Roadmap for ver. 2.0
146// ! - [ ] ARIA symmetric-key encryption/decryption algorithm
147// !     --- Includes ARIA and its expanded versions. `ARIA_Generic`
148// !     ===> Moved to Roadmap for ver. 2.0
149// ! - [ ] LEA symmetric-key encryption/decryption algorithm
150// !     --- Includes LEA and its expanded versions. `LEA_Generic`
151// !     ===> Moved to Roadmap for ver. 2.0
152// ! - [ ] RC2 symmetric-key encryption/decryption algorithm
153// !     --- Includes RC2 and its expanded versions. `RC2_Generic`
154// !     ===> Moved to Roadmap for ver. 2.0
155// ! - [ ] RC4 symmetric-key encryption/decryption algorithm
156// !     --- Includes RC4 and its expanded versions. `RC4_Generic`
157// !     ===> Moved to Roadmap for ver. 2.0
158// ! - [ ] RC5 symmetric-key encryption/decryption algorithm
159// !     --- Includes RC5 and its expanded versions. `RC5_Generic`
160// !     ===> Moved to Roadmap for ver. 2.0
161// ! - [ ] RC6 symmetric-key encryption/decryption algorithm
162// !     --- Includes RC6 and its expanded versions. `RC6_Generic`
163// !     ===> Moved to Roadmap for ver. 2.0
164// ! - [ ] Salsa20 symmetric-key encryption/decryption algorithm
165// !     --- Includes Salsa20 and its expanded versions. `Salsa20_Generic`
166// !     ===> Moved to Roadmap for ver. 2.0
167// ! - [ ] Chacha20 symmetric-key encryption/decryption algorithm
168// !     --- Includes Chacha20 and its expanded versions. `Chacha20_Generic`
169// !     ===> Moved to Roadmap for ver. 2.0
170// ! - [ ] IDEA symmetric-key encryption/decryption algorithm
171// !     --- Includes IDEA and its expanded versions. `IDEA_Generic`
172// !     ===> Moved to Roadmap for ver. 2.0
173//!  - [ ] BigCryptor64 and BigCryptor128 combinations of symmetric-key encryption/decryption algorithms and the trait implementations of Operation modes and padding bits for BigCryptor64 and BigCryptor128
174//!     --- Includes 2DES, 3DES, 4DES, etc., 2AES, 3AES, 4AES, etc., and their expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits according to PKCS#7 and ISO 7816-4. `NAES`, `ECB_PKCS7`, `ECB_ISO`, `CBC_PKCS7`, `CBC_ISO`, `PCBC_PKCS7`, `PCBC_ISO`, `CFB`, `OFB`, and `CTR`.
175//! 
176//! ## Pseudo-Random Number Generator Algorithms
177//! - [ ] Pseudo-random number generator --- struct
178//!       [`Random_Generic`](random/random/struct.Random_Generic.html#struct.Random_Generic)
179//!       and trait
180//!       [Random_Engine](random/trait_random_engine/trait.Random_Engine.html#trait.Random_Engine)
181//! - [ ] Pseudo-random number generator engines using hash algorithms ---
182//!       [`Any_MD4`](random/random/struct.Any_MD4.html#struct.Any_MD4),
183//!       [`Any_MD5`](random/random/struct.Any_MD5.html#struct.Any_MD5),
184//!       [`Any_SHA0`](random/random/struct.Any_SHA0.html#struct.Any_SHA0),
185//!       [`Any_SHA1`](random/random/struct.Any_SHA1.html#struct.Any_SHA1),
186//!       [`Any_SHA2_256`](random/random/struct.Any_SHA2_256.html#struct.Any_SHA2_256),
187//!       [`Any_SHA2_512`](random/random/struct.Any_SHA2_512.html#struct.Any_SHA2_512),
188//!       [`Any_SHA3_256`](random/random/struct.Any_SHA3_256.html#struct.Any_SHA3_256),
189//!       [`Any_SHA3_512`](random/random/struct.Any_SHA3_512.html#struct.Any_SHA3_512),
190//!       [`Any_SHAKE_128`](random/random/struct.Any_SHAKE_128.html#struct.Any_SHAKE_128),
191//!       [`Random_SHA2_512`](random/random/struct.Random_SHA2_512.html#struct.Random_SHA2_512).
192//!       [`Random_SHA3_512`](random/random/struct.Random_SHA3_512.html#struct.Random_SHA3_512), and
193//!       [`Random_BIG_KECCAK_1024`](random/random/struct.Random_BIG_KECCAK_1024.html#struct.Random_BIG_KECCAK_1024),
194//! - [ ] Pseudo-random number generator engines using symmetric-key encryption algorithms ---
195//!       [`Any_DES`](random/random/struct.Any_DES.html#struct.Any_DES),    
196//!       `Any_TDES`, `Any_AES`, `Any_TAES`, `Random_AES`, and `Random_TAES`.
197//! - [ ] Pseudo-random number generator engines using simple randomization algorithm
198//!       --- [`Any_Num_C`](random/random/struct.Any_Num.html#struct.Any_Num_C)
199//! 
200//! ## Asymmetric-Key Algorithms for the Encryption/Decryption of digital data
201// ! - [ ] Diffie-Hellman --> Thinking about postponing to Roadmap for ver. 2.0
202// ! - [ ] ElGamal --> Moved to Roadmap for ver. 2.0
203//! - [ ] RSA (Ron Rivest, Adi Shamir, Leonard Adleman)
204//! - [ ] ECC (Elliptic Curve Cryptosystem)
205// ! - [ ] Rabin --> Moved to Roadmap for ver. 2.0
206//! 
207//! When the implementation of all the above functionalitis are completed,
208//! the version number 1.0.0.0 will be given. After that whenever another
209//! functionality is added to this crate, the version number will get higher
210//! beyond 1.0.0.0. Before the version number 1.0.0.0, the maximum version
211//! number will be 0.20.x.x since there are all twenty-five functionalities
212//! listed above. So, for example, even if the version number is 0.5.0.0,
213//! it does not mean that 50% of all functionalities are implemented.
214
215
216#![doc(
217    html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
218    html_favicon_url = "https://www.rust-lang.org/favicon.ico",
219    html_root_url = "https://rust-random.github.io/rand/"
220)]
221
222pub mod number;
223pub mod hash;
224pub mod symmetric;
225pub mod random;