keyfork-shard: clean up documentation for encrypted shard padding

This commit is contained in:
Ryan Heywood 2024-05-03 22:41:38 -04:00
parent e0687434ef
commit 1a036a0b5f
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 6 additions and 4 deletions

View File

@ -25,9 +25,11 @@ use sha2::Sha256;
use sharks::{Share, Sharks};
use x25519_dalek::{EphemeralSecret, PublicKey};
// 32-byte share, 1-byte index, 1-byte threshold, 1-byte version == 36 bytes
// Encrypted, is 52 bytes
const PLAINTEXT_LENGTH: u8 = 36;
const PLAINTEXT_LENGTH: u8 = 32 // shard
+ 1 // index
+ 1 // threshold
+ 1 // version
+ 1; // length;
const ENCRYPTED_LENGTH: u8 = PLAINTEXT_LENGTH + 16;
#[cfg(feature = "openpgp")]
@ -271,7 +273,7 @@ pub trait Format {
payload.insert(1, threshold);
assert!(
payload.len() < PLAINTEXT_LENGTH as usize,
"invalid share length (too long, max {PLAINTEXT_LENGTH} bytes)"
"invalid share length (too long, must be less than {PLAINTEXT_LENGTH} bytes)"
);
// convert plaintext to static-size payload