本文整理汇总了C#中IDigest.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# IDigest.Reset方法的具体用法?C# IDigest.Reset怎么用?C# IDigest.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDigest
的用法示例。
在下文中一共展示了IDigest.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateHashForZeroKnowledgeProof
private static BigInteger CalculateHashForZeroKnowledgeProof(BigInteger g, BigInteger gr, BigInteger gx,
string participantId, IDigest digest)
{
digest.Reset();
UpdateDigestIncludingSize(digest, g);
UpdateDigestIncludingSize(digest, gr);
UpdateDigestIncludingSize(digest, gx);
UpdateDigestIncludingSize(digest, participantId);
byte[] output = DigestUtilities.DoFinal(digest);
return new BigInteger(output);
}
示例2: CalculateMacKey
/// <summary>
/// Calculates the MacKey (i.e. the key to use when calculating the MagTag for key confirmation).
///
/// MacKey = H(K || "JPAKE_KC")
/// </summary>
private static byte[] CalculateMacKey(BigInteger keyingMaterial, IDigest digest)
{
digest.Reset();
UpdateDigest(digest, keyingMaterial);
/*
* This constant is used to ensure that the macKey is NOT the same as the derived key.
*/
UpdateDigest(digest, "JPAKE_KC");
return DigestUtilities.DoFinal(digest);
}
示例3: ComputeDigest
/// <summary>
/// Computes hash of the data
/// </summary>
/// <param name="digest">Hash algorithm implementation</param>
/// <param name="data">Data that should be processed</param>
/// <returns>Hash of data</returns>
private static byte[] ComputeDigest(IDigest digest, byte[] data)
{
if (digest == null)
throw new ArgumentNullException("digest");
if (data == null)
throw new ArgumentNullException("data");
byte[] hash = new byte[digest.GetDigestSize()];
digest.Reset();
digest.BlockUpdate(data, 0, data.Length);
digest.DoFinal(hash, 0);
return hash;
}