diff --git a/umskt/src/confid/mod.rs b/umskt/src/confid/mod.rs index 710668d..4b81a92 100644 --- a/umskt/src/confid/mod.rs +++ b/umskt/src/confid/mod.rs @@ -1,3 +1,13 @@ +//! Code to generate a Confirmation ID for a given Installation ID +//! +//! ## History +//! The algorithm this uses was originally provided to the UMSKT project by diamondggg. +//! The history provided by diamondggg is that they are the originator of the code +//! and was created in tandem with an acquaintance who knows number theory. +//! The file dates suggest this code was written sometime in 2017/2018. +//! +//! The Rust version of the code was created by running the original through C2Rust +//! and then manually fixing up the result. use thiserror::Error; mod black_box; @@ -18,6 +28,10 @@ pub enum ConfirmationIdError { Unlucky, } +/// Generates a confirmation ID from the given installation ID +/// +/// # Arguments +/// * `installation_id` - A string with 7 groups of 6 digits, with or without hyphens pub fn generate(installation_id: &str) -> Result { if installation_id.len() < 54 { return Err(ConfirmationIdError::TooShort);