Skip to content

Commit ce004ff

Browse files
committed
Improve peppy
1 parent c0e9d0c commit ce004ff

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/bin/peppy.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ struct GenerateSessionKeys {
3535
struct RandomPseudonym {}
3636

3737
#[derive(Command, Debug, Default)]
38-
#[command("pseudonym-from-origin")]
39-
#[description("Create a pseudonym from an existing identifier (16 bytes).")]
40-
struct PseudonymFromOrigin {
41-
#[positional("origin", 1, 1)]
38+
#[command("pseudonym-encode")]
39+
#[description("Encode an identifier into a pseudonym (or long pseudonym if > 16 bytes).")]
40+
struct PseudonymEncode {
41+
#[positional("identifier", 1, 1)]
4242
args: Vec<String>,
4343
}
4444

4545
#[derive(Command, Debug, Default)]
46-
#[command("pseudonym-to-origin")]
47-
#[description("Try to convert a pseudonym (or long pseudonym) back to its origin identifier.")]
48-
struct PseudonymToOrigin {
46+
#[command("pseudonym-decode")]
47+
#[description("Decode a pseudonym (or long pseudonym) back to its origin identifier.")]
48+
struct PseudonymDecode {
4949
#[positional("pseudonym-hex...", 1, 100)]
5050
args: Vec<String>,
5151
}
@@ -137,8 +137,8 @@ enum Sub {
137137
GenerateGlobalKeys(GenerateGlobalKeys),
138138
GenerateSessionKeys(GenerateSessionKeys),
139139
RandomPseudonym(RandomPseudonym),
140-
PseudonymFromOrigin(PseudonymFromOrigin),
141-
PseudonymToOrigin(PseudonymToOrigin),
140+
PseudonymEncode(PseudonymEncode),
141+
PseudonymDecode(PseudonymDecode),
142142
Encrypt(Encrypt),
143143
EncryptGlobal(EncryptGlobal),
144144
Decrypt(Decrypt),
@@ -190,11 +190,11 @@ fn main() {
190190
eprint!("Random pseudonym: ");
191191
println!("{}", &pseudonym.encode_as_hex());
192192
}
193-
Some(Sub::PseudonymFromOrigin(arg)) => {
193+
Some(Sub::PseudonymEncode(arg)) => {
194194
let origin = arg.args[0].as_bytes();
195195
match origin.len().cmp(&16) {
196196
Ordering::Greater => {
197-
eprintln!("Warning: Origin identifier is longer than 16 bytes, using long pseudonym with PKCS#7 padding.");
197+
eprintln!("Warning: Identifier is longer than 16 bytes, using long pseudonym with PKCS#7 padding. This comes with privacy risks, as blocks can highlight subgroups and the number of blocks is visible.");
198198
let long_pseudonym = LongPseudonym::from_bytes_padded(origin)
199199
.expect("Failed to create long pseudonym");
200200
eprint!("Long pseudonym ({} blocks): ", long_pseudonym.0.len());
@@ -216,7 +216,7 @@ fn main() {
216216
}
217217
};
218218
}
219-
Some(Sub::PseudonymToOrigin(arg)) => {
219+
Some(Sub::PseudonymDecode(arg)) => {
220220
if arg.args.len() == 1 {
221221
// Single pseudonym - try lizard decoding
222222
let pseudonym =
@@ -226,7 +226,7 @@ fn main() {
226226
eprintln!("Pseudonym does not have a lizard representation.");
227227
std::process::exit(1);
228228
}
229-
eprint!("Origin: ");
229+
eprint!("Value: ");
230230
println!(
231231
"{}",
232232
String::from_utf8_lossy(
@@ -244,7 +244,7 @@ fn main() {
244244
let text = long_pseudonym
245245
.to_string_padded()
246246
.expect("Failed to decode long pseudonym");
247-
eprint!("Origin: ");
247+
eprint!("Value: ");
248248
println!("{}", text);
249249
}
250250
}

0 commit comments

Comments
 (0)