This commit is contained in:
Florian Geiger 2022-12-01 15:40:34 +01:00
commit e943e4cbb5
2 changed files with 13 additions and 1 deletions

View File

@ -18,7 +18,17 @@ fn main() {
0xbd, 0xdd, 0x15, 0xc3, 0xb5, 0x96, 0x41, 0x17, 0x4e, 0xc9, 0x67, 0x8a, 0x53, 0x78, 0xbd, 0xdd, 0x15, 0xc3, 0xb5, 0x96, 0x41, 0x17, 0x4e, 0xc9, 0x67, 0x8a, 0x53, 0x78,
0x9d, 0x92, 0xc7, 0x54, 0x9d, 0x92, 0xc7, 0x54,
]); ]);
let (salsa_box, pub_key) = generate_box(bob_init_pub_key.clone());
// Generate a random secret key.
// NOTE: The secret key bytes can be accessed by calling `secret_key.as_bytes()`
let own_secret_key = SecretKey::generate(&mut OsRng);
// Get the public key for the secret key we just generated
let own_public_key = own_secret_key.public_key().clone();
// Create a `SalsaBox` by performing Diffie-Hellman key agreement between
// the two keys.
let salsa_box = SalsaBox::new(&bob_init_pub_key, &own_secret_key);
loop { loop {
let mut buffer = String::new(); let mut buffer = String::new();

2
src/bin/constants.rs Normal file
View File

@ -0,0 +1,2 @@
pub const KEYBYTE: u8 = 0b1;
pub const MSGBYTE: u8 = 0b01;