1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
// SPDX-License-Identifier: GPL-3.0-or-later
//! ## Usage
//! Unlike traditional encryption algorithms that output ciphertext to a given plaintext,
//! False Bottom works by "adding" messages to an existing ciphertext.
//! As such, the initial ciphertext and the keybase are generated from random data.
//! The ciphertext then grows as messages are added whereas the keybase is fixed
//! after initialization and is used to generate the keys for the ciphertext.
//! The parameters for the [`init()`](FBObj::init()) function determine the size
//! (in number of blocks) of the initial ciphertext and keybase respectively.
//! Type aliases over [`FBObj`] are provided to pick a block size.
//! Ex: [`FB128`] corresponds to a block size of 128 bits.
//!
//! ### Cipher Initialization:
//! ```rust
//! use false_bottom::{FB128, FBAlgo};
//! // 15 blocks of ciphertext and 12 blocks of keybase with a block size of 128 bits.
//! let fb = FB128::init(15, 12);
//! ```
//!
//! ### Adding Messages:
//! Messages can be added using the [`add()`](FBObj::add()) method.
//! This method returns an object [`FBKey`] that represents the corresponding key for this message.
//! This key can only be used to decrypt this message.
//! ```rust
//! let msg = b"Hello World!";
//! let key = fb.add(&msg);
//! ```
//!
//! ### Decryption:
//! The [`decrypt()`](FBObj::decrypt()) method returns the message that corresponds
//! to the provided [`FBKey`].
//! ```rust
//! let decrypted = fb.decrypt(&key).unwrap();
//! ```
//! There is also an example [here](latest/source/examples/encryption.rs).
//!
//! ### Import and Export
//! Available formats: Raw bytes and Base64 encoded.
//! Refer to the [example](latest/source/examples/export.rs)
mod algo;
mod arithmetic;
mod encoding;
mod errors;
mod fbkey;
mod fbobj;
mod packing;
pub use crate::{
errors::FBError,
fbobj::{
FBObj,
fb128::FB128,
},
algo::FBAlgo,
fbkey::FBKey,
encoding::Encode,
};
use crate::{
algo::BlockOps,
arithmetic::{FieldOps, WrappingOps},
fbobj::FBObjTrait,
packing::Packing,
};