0.1.0 |
|
---|
#12 in #艾丽丝
25KB
329 行
ez_pqcrypto
封装了pqcrypto。通过设置一个单字节大小的值,允许选择后量子加密算法。对于多算法或非确定性方案很有用
// Alice wants to share data with Bob. She first creates a PostQuantumContainer
let mut alice_container = PostQuantumContainer::new_alice(algorithm_dictionary::BABYBEAR);
// Then, alice sender her public key to Bob. She must also send the byte value of algorithm_dictionary::BABYBEAR to him
let alice_public_key = alice_container.get_public_key();
let algorithm_byte_value = algorithm_dictionary::BABYBEAR;
//
// Then, Bob gets the public key. To process it, he must create a PostQuantumContainer for himself
let bob_container = PostQuantumContainer::new_bob(algorithm_byte_value, alice_public_key);
// Internally, this computes the CipherText. The next step is to send this CipherText back over to alice
let bob_ciphertext = bob_container.get_ciphertext();
//
// Next, alice received Bob's ciphertext. She must now run an update on her internal data in order to get the shared secret
alice_container.alice_on_receive_ciphertext(bob_ciphertext);
assert_eq!(alice_container.get_shared_secret(), bob_container.get_shared_secret());
依赖项
~392MB
~9M SLoC