From 369b8b04bcf585c59f98dd512f6806071ca1e643 Mon Sep 17 00:00:00 2001 From: Alex Page Date: Wed, 28 Jun 2023 21:11:05 -0400 Subject: [PATCH] Add documentation for confid --- umskt/src/confid/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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);