pub fn encrypt<M: AsRef<[u8]>>(&self, message: M) -> Result<Vec<u8>> {
        encrypt_context_imprint(
            self.0.master_key.as_bytes(),
            message.as_ref(),
            self.0.user_context.as_bytes(),
        )
    }
/// Encrypts the provided message and returns the encrypted data.
///
/// The resulting message has the same length as the input data and does not contain
/// an authentication token. Secure Cell cannot ensure correctness of later decryption
/// if the message gets corrupted or a different master key is used.
///
/// # Examples
///
/// You can use anything convertible into a byte slice as a message: a byte slice or an array,
/// a `Vec<u8>`, or a `String`.
///
/// ```
/// # fn main() -> Result<(), themis::Error> {
/// use themis::secure_cell::SecureCell;
///
/// let cell = SecureCell::with_key_and_context(b"password", b"context").context_imprint();
///
/// cell.encrypt(b"byte string")?;
/// cell.encrypt(&[1, 2, 3, 4, 5])?;
/// cell.encrypt(vec![6, 7, 8, 9])?;
/// cell.encrypt(format!("owned string"))?;
/// # Ok(())
/// # }
/// ```
///
/// However, the message must not be empty:
///
/// ```
/// # use themis::secure_cell::SecureCell;
/// #
/// # let cell = SecureCell::with_key_and_context(b"password", b"context").context_imprint();
/// #
/// assert!(cell.encrypt(&[]).is_err());
/// ```
///
/// Also, you cannot use empty context with context imprint mode:
///
/// ```
/// # use themis::secure_cell::SecureCell;
/// #
/// let cell = SecureCell::with_key(b"password").context_imprint();
///
/// assert!(cell.encrypt(b"otherwise fine message").is_err());
/// ```
Encrypts the provided message and returns the encrypted data.
The resulting message has the same length as the input data and does not contain
an authentication token. Secure Cell cannot ensure correctness of later decryption
if the message gets corrupted or a different master key is used.
Encrypts the provided message and returns the encrypted data . The resulting message has the same length as the input data and does not contain an authentication token . Secure Cell cannot ensure correctness of later decryption if the message gets corrupted or a different master key is used .
pub fn encrypt<M: AsRef<[u8]>>(&self, message: M) -> Result<Vec<u8>> {
        encrypt_context_imprint(
            self.0.master_key.as_bytes(),
            message.as_ref(),
            self.0.user_context.as_bytes(),
        )
    }
pub fn encrypt < M : AsRef < [ u8 ] > > ( & self , message : M ) -> Result < Vec < u8 > > { encrypt_context_imprint ( self . 0 . master_key . as_bytes ( ) , message . as_ref ( ) , self . 0 . user_context . as_bytes ( ) , ) }
Encrypts the provided message and returns the encrypted data.
Encrypts the provided message and returns the encrypted data .
&self
message
M
&self
message
M
examples
You can use anything convertible into a byte slice as a message: a byte slice or an array,
a `Vec`, or a `String`.


You can use anything convertible into a byte slice as a message : a byte slice or an array a ` Vec ` or a ` String ` .
fn main() -> result<(), themis::error> {
use themis::secure_cell::SecureCell.

let cell = SecureCell::with_key_and_context(b"password", b"context").context_imprint().


use themis :: secure_cell :: SecureCell . let cell = SecureCell :: with_key_and_context ( b " password " b " context " ) . context_imprint () .
ok(())
None
}


However, the message must not be empty.


However the message must not be empty .
use themis::secure_cell::securecell;
None
let cell = securecell::with_key_and_context(b"password", b"context").context_imprint();


Also, you cannot use empty context with context imprint mode.


Also you cannot use empty context with context imprint mode .
use themis::secure_cell::securecell;
let cell = SecureCell::with_key(b"password").context_imprint().

assert!(cell.encrypt(b"otherwise fine message").is_err());
```
let cell = SecureCell :: with_key ( b " password " ) . context_imprint () . assert! ( cell . encrypt ( b " otherwise fine message " ) . is_err () ) ; ` ` `