pub fn encrypt_symmetric(_msg: &bn::Gt, _plaintext: &Vec<u8>) -> Option<Vec<u8>> {
    let mut _key: [u8; 32] = [0; 32];
    let mut _iv: Vec<u8> = vec![0; 16];
    let mut _ret: Vec<u8> = Vec::new();
    let mut _sha = Sha3::sha3_256();
    let mut _rng = thread_rng();
    match serialize(&_msg) {
        Err(_) => return None,
        Ok(_serialized_msg) => {
            _sha.input(&_serialized_msg);
            _sha.result(&mut _key);
            _rng.fill_bytes(&mut _iv);
            _ret.append(&mut _iv.clone());
            let mut encrypted_data = encrypt_aes(&_plaintext, &_key, &_iv).ok().unwrap();
            _ret.append(&mut encrypted_data);
            return Some(_ret);
        }
    }
}
/// Key Encapsulation Mechanism (Encryption Function)
Key Encapsulation Mechanism (Encryption Function)
Key Encapsulation Mechanism ( Encryption Function )
pub fn encrypt_symmetric(_msg: &bn::Gt, _plaintext: &Vec<u8>) -> Option<Vec<u8>> {
    let mut _key: [u8; 32] = [0; 32];
    let mut _iv: Vec<u8> = vec![0; 16];
    let mut _ret: Vec<u8> = Vec::new();
    let mut _sha = Sha3::sha3_256();
    let mut _rng = thread_rng();
    match serialize(&_msg) {
        Err(_) => return None,
        Ok(_serialized_msg) => {
            _sha.input(&_serialized_msg);
            _sha.result(&mut _key);
            _rng.fill_bytes(&mut _iv);
            _ret.append(&mut _iv.clone());
            let mut encrypted_data = encrypt_aes(&_plaintext, &_key, &_iv).ok().unwrap();
            _ret.append(&mut encrypted_data);
            return Some(_ret);
        }
    }
}
pub fn encrypt_symmetric ( _msg : & bn :: Gt , _plaintext : & Vec < u8 > ) -> Option < Vec < u8 > > { let mut _key : [ u8 ; 32 ] = [ 0 ; 32 ] ; let mut _iv : Vec < u8 > = vec ! [ 0 16 ] ; let mut _ret : Vec < u8 > = Vec :: new ( ) ; let mut _sha = Sha3 :: sha3_256 ( ) ; let mut _rng = thread_rng ( ) ; match serialize ( & _msg ) { Err ( _ ) => return None , Ok ( _serialized_msg ) => { _sha . input ( & _serialized_msg ) ; _sha . result ( & mut _key ) ; _rng . fill_bytes ( & mut _iv ) ; _ret . append ( & mut _iv . clone ( ) ) ; let mut encrypted_data = encrypt_aes ( & _plaintext , & _key , & _iv ) . ok ( ) . unwrap ( ) ; _ret . append ( & mut encrypted_data ) ; return Some ( _ret ) ; } } }
Key Encapsulation Mechanism (Encryption Function)
Key Encapsulation Mechanism ( Encryption Function )
_msg
&bn::Gt
_plaintext
&Vec<u8>
_msg
&bn::Gt
_plaintext
&Vec<u8>