Skip to main content

validate_malo_id

Function validate_malo_id 

Source
pub fn validate_malo_id(value: &str) -> ConditionResult
Expand description

Validate Marktlokations-ID (MaLo-ID): exactly 11 digits with BDEW check digit.

This is not standard Luhn — per the BDEW “Anwendungshilfe MaLo-ID v1.0” spec and the Hochfrequenz BO4E-dotnet reference implementation (BO4E/BO/Marktlokation.cs::GetChecksum), digits 1–10 are numbered left-to-right (1-based), digits at even positions are multiplied by 2 and added as the full value (no digit-sum, no mod-by-9 step), digits at odd positions are added as-is. Check digit = (10 - (sum mod 10)) mod 10.

Example: "51238696781" — odd (1,3,5,7,9): 5+2+8+9+7=31; even doubled (2,4,6,8,10): 2*(1+3+6+6+8)=48; sum=79; check = (10-79%10)%10 = 1 ✓.