fn symcipher_decode(key:&[u8], data:&[u8])->Option<Vec<u8>> {
    assert!(key.len()==constants::U256_SIZE);
    let nonce = Nonce::from_slice(&constants::ENCRYPTION_NONCE);
    let cipher = ChaCha20Poly1305::new(Key::from_slice(key));
    cipher.decrypt(nonce, data).ok()

}
//key stricly assumed to be unique for all messages. Using this function with multiple messages and one key is insecure!
key stricly assumed to be unique for all messages. Using this function with multiple messages and one key is insecure!
key stricly assumed to be unique for all messages . Using this function with multiple messages and one key is insecure!
fn symcipher_decode(key:&[u8], data:&[u8])->Option<Vec<u8>> {
    assert!(key.len()==constants::U256_SIZE);
    let nonce = Nonce::from_slice(&constants::ENCRYPTION_NONCE);
    let cipher = ChaCha20Poly1305::new(Key::from_slice(key));
    cipher.decrypt(nonce, data).ok()
}
fn symcipher_decode ( key : & [ u8 ] , data : & [ u8 ] ) -> Option < Vec < u8 > > { assert ! ( key len ( ) constants U256_SIZE ) ; let nonce = Nonce :: from_slice ( & constants :: ENCRYPTION_NONCE ) ; let cipher = ChaCha20Poly1305 :: new ( Key :: from_slice ( key ) ) ; cipher . decrypt ( nonce , data ) . ok ( ) }
key stricly assumed to be unique for all messages.
key stricly assumed to be unique for all messages .
key
&[u8]
data
&[u8]
key
&[u8]
data
&[u8]