pub fn finish(self) -> Result<Buffer> {
        let hash_size = self.hash_size()?;
        let mut result = Buffer::new(hash_size);

        unsafe {
            Error::check(BCryptFinishHash(
                self.handle.as_ptr(),
                result.as_mut_ptr(),
                result.len() as ULONG,
                0,
            ))
            .map(|_| result)
        }
    }
/// Get the hash value
///
/// This method consumes the hash operation. To create a new hash, a new instance must be created.
///
/// # Examples
///
/// ```
/// # use win_crypto_ng::hash::{HashAlgorithm, HashAlgorithmId};
/// let algo = HashAlgorithm::open(HashAlgorithmId::Sha256).unwrap();
/// let mut hash = algo.new_hash().unwrap();
/// hash.hash("Some data".as_bytes()).unwrap();
/// let result = hash.finish().unwrap();
///
/// assert_eq!(result.as_slice(), [
///     0x1F, 0xE6, 0x38, 0xB4, 0x78, 0xF8, 0xF0, 0xB2,
///     0xC2, 0xAA, 0xB3, 0xDB, 0xFD, 0x3F, 0x05, 0xD6,
///     0xDf, 0xE2, 0x19, 0x1C, 0xD7, 0xB4, 0x48, 0x22,
///     0x41, 0xFE, 0x58, 0x56, 0x7E, 0x37, 0xAE, 0xF6,
/// ]);
/// ```
Get the hash value
This method consumes the hash operation. To create a new hash, a new instance must be created.
Get the hash value This method consumes the hash operation . To create a new hash a new instance must be created .
pub fn finish(self) -> Result<Buffer> {
        let hash_size = self.hash_size()?;
        let mut result = Buffer::new(hash_size);
        unsafe {
            Error::check(BCryptFinishHash(
                self.handle.as_ptr(),
                result.as_mut_ptr(),
                result.len() as ULONG,
                0,
            ))
            .map(|_| result)
        }
    }
pub fn finish ( self ) -> Result < Buffer > { let hash_size = self . hash_size ( ) ? ; let mut result = Buffer :: new ( hash_size ) ; unsafe { Error :: check ( BCryptFinishHash ( self . handle . as_ptr ( ) , result . as_mut_ptr ( ) , result . len ( ) as ULONG , 0 , ) ) . map ( | _ | result ) } }
Get the hash value
This method consumes the hash operation.
Get the hash value This method consumes the hash operation .
self
self
examples
None
use win_crypto_ng::hash::{hashalgorithm, hashalgorithmid};
let algo = HashAlgorithm::open(HashAlgorithmId::Sha256).unwrap();
let mut hash = algo.new_hash().unwrap();
hash.hash("Some data".as_bytes()).unwrap();
let result = hash.finish().unwrap().


let algo = HashAlgorithm :: open ( HashAlgorithmId :: Sha256 ) . unwrap () ; let mut hash = algo . new_hash () . unwrap () ; hash . hash ( " Some data " . as_bytes () ) . unwrap () ; let result = hash . finish () . unwrap () .