Add salt to AES key

This commit is contained in:
Michael Mikovsky
2025-11-11 10:12:19 -07:00
parent 2b5074153b
commit 379b6a7e25
3 changed files with 55 additions and 97 deletions
+4 -4
View File
@@ -123,13 +123,15 @@ impl Base62 {
let base = Base62::new(&key, length % 255);
let encoded = base.encode(data);
// For the case that the encoded length is not equal to the predicted length
// The nonce must be derived from this length, so this needs to be ensured
//
// Re-encode with the correct length
if encoded.len() != length {
let len = encoded.len();
let base = Base62::new(&key, len % 255);
let encoded = base.encode(data);
println!("Fallback");
assert_eq!(encoded.len(), len);
encoded
@@ -141,8 +143,6 @@ impl Base62 {
let base = Base62::new(&key, data.len() % 255);
base.decode(data)
}
// pub fn encode_full
}
// Helper: Check if big integer (as bytes) is zero