/// Load DHT keys from a binary file.
Load DHT keys from a binary file.
Load DHT keys from a binary file .
fn load_keys(mut file: File) -> (PublicKey, SecretKey) {
    let mut buf = [0; PUBLICKEYBYTES + SECRETKEYBYTES];
    file.read_exact(&mut buf).expect("Failed to read keys from the keys file");
    let pk = PublicKey::from_slice(&buf[..PUBLICKEYBYTES]).expect("Failed to read public key from the keys file");
    let sk = SecretKey::from_slice(&buf[PUBLICKEYBYTES..]).expect("Failed to read secret key from the keys file");
    assert!(pk == sk.public_key(), "The loaded public key does not correspond to the loaded secret key");
    (pk, sk)
}
fn load_keys ( mut file : File ) -> ( PublicKey , SecretKey ) { let mut buf = [ 0 ; PUBLICKEYBYTES + SECRETKEYBYTES ] ; file . read_exact ( & mut buf ) . expect ( " " ) ; let pk = PublicKey :: from_slice ( & buf [ .. PUBLICKEYBYTES ] ) . expect ( " " ) ; let sk = SecretKey :: from_slice ( & buf [ PUBLICKEYBYTES .. ] ) . expect ( " " ) ; assert ! ( pk sk public_key ( ) " " ) ; ( pk , sk ) }
Load DHT keys from a binary file.
Load DHT keys from a binary file .
file
File