pub fn gen_code(
name: String,
id: String,
offset: Option<u32>,
prefix: Option<String>,
length: Option<usize>,
) -> (String, String)Expand description
Generate a cryptographic code for use in API calls.
Currently used by:
crate::tmf632::individual_v4::Individualcrate::tmf632::organization_v4::Organizationcrate::tmf629::customer::Customercrate::tmf674::geographic_site_v4::GeographicSite
§Returns
Returns tuple of the generated code and the Base32 Hash used to form the code.
§Algorithm
This function takes the supplied inputs (name, id , offset) and generates a cryptographic hash which is then output as a Base32 hash. Each Base32 digit represents 5 bits of binary data, so 6 digits provides 30 bits of data or around 1 Billion possible codes.
§Example
use tmflib::gen_code;
let (code,hash) = gen_code("John Q. Smith".to_string(),"USER123".to_string(),None,Some("U-".to_string()),None);
assert_eq!(code,"U-SP7E6E".to_string());