-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exchange sodiumoxide with maintained alternatives
- Loading branch information
1 parent
ce8546a
commit 1ab85df
Showing
15 changed files
with
272 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
use crypto_secretbox::aead::OsRng; | ||
use data_encoding::HEXLOWER; | ||
use sodiumoxide::crypto::box_; | ||
|
||
fn main() { | ||
println!("Generating new random nacl/libsodium crypto box keypair:\n"); | ||
let (pk, sk) = box_::gen_keypair(); | ||
println!(" Public: {}", HEXLOWER.encode(&pk.0)); | ||
println!(" Private: {}", HEXLOWER.encode(&sk.0)); | ||
let sk = crypto_box::SecretKey::generate(&mut OsRng); | ||
let pk = sk.public_key(); | ||
println!(" Public: {}", HEXLOWER.encode(pk.as_bytes())); | ||
println!(" Private: {}", HEXLOWER.encode(&sk.to_bytes())); | ||
println!("\nKeep the private key safe, and don't share it with anybody!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.