本文整理汇总了C#中Mono.Math.BigInteger.modPow方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.modPow方法的具体用法?C# BigInteger.modPow怎么用?C# BigInteger.modPow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Math.BigInteger
的用法示例。
在下文中一共展示了BigInteger.modPow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeAESKey
public void MakeAESKey(string keyExchangeBytes)
{
BigInteger A = new BigInteger(keyExchangeBytes);
byte[] R = A.modPow(privateKey, Module).getBytes();
aesKey = new byte[16];
Array.Copy(R, aesKey, 16);
for (int i = 0; i < 16; i++)
{
byte tmp = (byte)(aesKey[i] >> 4);
byte tmp2 = (byte)(aesKey[i] & 0xF);
if (tmp > 9)
tmp = (byte)(tmp - 9);
if (tmp2 > 9)
tmp2 = (byte)(tmp2 - 9);
aesKey[i] = (byte)( tmp << 4 | tmp2);
}
}
示例2: DecryptKeyExchange
/// <summary>
/// Extracts secret information from the key exchange data.
/// </summary>
/// <param name="keyEx">The key exchange data within which the shared key is hidden.</param>
/// <returns>The shared key derived from the key exchange data.</returns>
public override byte[] DecryptKeyExchange(byte[] keyEx)
{
BigInteger pvr = new BigInteger(keyEx);
BigInteger z = pvr.modPow(m_X, m_P);
byte[] ret = z.getBytes();
z.Clear();
return ret;
}