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 c822608 commit 51fe985Copy full SHA for 51fe985
src/mnemonic.rs
@@ -72,7 +72,8 @@ impl Mnemonic {
72
}
73
74
writer.flush().unwrap();
75
- let (payload, checksum) = data.split_at(data.len() - std::cmp::max(1,data.len()/32));
+ let l = data.len();
76
+ let (payload, checksum) = data.split_at(l - if l > 33 {2} else {1});
77
if Self::checksum(payload).as_slice() != checksum {
78
return Err(Error::Mnemonic("Checksum failed"));
79
@@ -149,7 +150,6 @@ mod test {
149
150
let values = tests[t].as_array().unwrap();
151
let data = decode(values[0].as_str().unwrap()).unwrap();
152
let m = values[1].as_str().unwrap();
- println!("{}", m);
153
let mnemonic = Mnemonic::from_str(m).unwrap();
154
let seed = mnemonic.to_seed(Some("TREZOR"));
155
assert_eq!(
0 commit comments