pub fn sign(&self, message: &[u8]) -> Result<[u8; 65], CryptoError> {
        let hashed_msg = message.keccak256();
        let message_to_sign = secp256k1::Message::parse(&hashed_msg);

        let (sig, recovery) = secp256k1::sign(&message_to_sign, &self.privkey)
            .map_err(|_| CryptoError::SigningError { hashed_msg: *hashed_msg })?;

        let v: u8 = recovery.into();
        let mut returnvalue = [0u8; 65];
        returnvalue[..64].copy_from_slice(&sig.serialize());
        returnvalue[64] = v + 27;
        Ok(returnvalue)
    }
/// Sign a message using the Private Key.
/// # Examples
/// Simple Message signing:
/// ```
/// use enigma_crypto::KeyPair;
/// let keys = KeyPair::new().unwrap();
/// let msg = b"Sign this";
/// let sig = keys.sign(msg);
/// ```
///
/// The function returns a 65 bytes slice that contains:
/// 1. 32 Bytes, ECDSA `r` variable.
/// 2. 32 Bytes ECDSA `s` variable.
/// 3. 1 Bytes ECDSA `v` variable aligned to the right for Ethereum compatibility
Sign a message using the Private Key.
Sign a message using the Private Key .
pub fn sign(&self, message: &[u8]) -> Result<[u8; 65], CryptoError> {
        let hashed_msg = message.keccak256();
        let message_to_sign = secp256k1::Message::parse(&hashed_msg);
        let (sig, recovery) = secp256k1::sign(&message_to_sign, &self.privkey)
            .map_err(|_| CryptoError::SigningError { hashed_msg: *hashed_msg })?;
        let v: u8 = recovery.into();
        let mut returnvalue = [0u8; 65];
        returnvalue[..64].copy_from_slice(&sig.serialize());
        returnvalue[64] = v + 27;
        Ok(returnvalue)
    }
pub fn sign ( & self , message : & [ u8 ] ) -> Result < [ u8 ; 65 ] , CryptoError > { let hashed_msg = message . keccak256 ( ) ; let message_to_sign = secp256k1 :: Message :: parse ( & hashed_msg ) ; let ( sig , recovery ) = secp256k1 :: sign ( & message_to_sign , & self . privkey ) . map_err ( | _ | CryptoError :: SigningError { hashed_msg : * hashed_msg } ) ? ; let v : u8 = recovery . into ( ) ; let mut returnvalue = [ 0u8 ; 65 ] ; returnvalue [ .. 64 ] . copy_from_slice ( & sig . serialize ( ) ) ; returnvalue [ 64 ] = v + 27 ; Ok ( returnvalue ) }
Sign a message using the Private Key.
Sign a message using the Private Key .
&self
message
&[u8]
&self
message
&[u8]
examples
Simple Message signing:
```
use enigma_crypto::KeyPair;
let keys = KeyPair::new().unwrap();
let msg = b"Sign this";
let sig = keys.sign(msg);
```

The function returns a 65 bytes slice that contains:
1. 32 Bytes, ECDSA `r` variable.
2. 32 Bytes ECDSA `s` variable.
3. 1 Bytes ECDSA `v` variable aligned to the right for Ethereum compatibility
Simple Message signing : ` ` ` use enigma_crypto :: KeyPair ; let keys = KeyPair :: new () . unwrap () ; let msg = b " Sign this " ; let sig = keys . sign ( msg ) ; ` ` ` The function returns a 65 bytes slice that contains : 1 . 32 Bytes ECDSA ` r ` variable . 2 . 32 Bytes ECDSA ` s ` variable . 3 . 1 Bytes ECDSA ` v ` variable aligned to the right for Ethereum compatibility