<PackageReference Include="BouncyCastle.Cryptography" Version="2.7.0" />

Org.BouncyCastle.Security.DigestUtilities

public static class DigestUtilities
Factory for IDigest instances and convenience helpers for one-shot hash computation.
public static byte[] CalculateDigest(AlgorithmIdentifier algID, byte[] buf)

One-shot digest of buf, using the algorithm identified by algID.

public static byte[] CalculateDigest(AlgorithmIdentifier algID, byte[] buf, int off, int len)

One-shot digest of len bytes from buf, starting at offset off, using the algorithm identified by algID.

public static byte[] CalculateDigest(DerObjectIdentifier id, byte[] input)

One-shot digest of input, using the algorithm identified by id.

public static byte[] CalculateDigest(DerObjectIdentifier oid, byte[] buf, int off, int len)

One-shot digest of len bytes from buf, starting at offset off, using the algorithm identified by oid.

public static byte[] CalculateDigest(string algorithm, byte[] input)

One-shot digest of input, using the algorithm identified by algorithm.

public static byte[] CalculateDigest(string algorithm, byte[] buf, int off, int len)

One-shot digest of len bytes from buf, starting at offset off, using the algorithm identified by algorithm.

public static byte[] DoFinal(IDigest digest)

Finalises digest and returns the resulting hash as a fresh array.

public static byte[] DoFinal(IDigest digest, byte[] input)

Feeds input into digest, then finalises and returns the hash.

public static byte[] DoFinal(IDigest digest, byte[] buf, int off, int len)

Feeds len bytes from buf at offset off into digest, then finalises and returns the hash.

public static string GetAlgorithmName(DerObjectIdentifier oid)

Returns the canonical algorithm name registered for the given ASN.1 OID, or null if the OID is not mapped to a known digest.

public static IDigest GetDigest(AlgorithmIdentifier algID)

Resolve and instantiate an IDigest for the given ASN.1 algorithm.

Resolve and instantiate an IDigest for the given ASN.1 algorithm OID.

public static IDigest GetDigest(string algorithm)

Resolve and instantiate an IDigest by name (or alias).

public static DerObjectIdentifier GetObjectIdentifier(string mechanism)

Returns the ASN.1 OID associated with the named digest mechanism, or null when none is registered.