We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4151871 commit 45b4a5fCopy full SHA for 45b4a5f
src/otp/otp_element.rs
@@ -222,10 +222,10 @@ impl OTPElement {
222
223
fn format_code(&self, value: u32) -> Result<String, OtpError> {
224
// Get the formatted code
225
- let exponential = 10_u32
+ let exponential = 10_u64
226
.checked_pow(self.digits as u32)
227
.ok_or(OtpError::InvalidDigits)?;
228
- let s = (value % exponential).to_string();
+ let s = (value as u64 % exponential).to_string();
229
Ok("0".repeat(self.digits as usize - s.chars().count()) + s.as_str())
230
}
231
0 commit comments