public static bool CheckECP(byte[] msg, BigInteger S, BigInteger N, BigInteger E) { BigInteger temp = BigInteger.ModPow(S, E, N); HashMd5 hash = new HashMd5(); msg = hash.ComputeHash(msg); BigInteger M = BigInteger.Abs(HashMd5.HashToBig(msg)); return(M == temp); }
public static BigInteger ComputeS(byte[] msg, BigInteger D, BigInteger N) { HashMd5 hash = new HashMd5(); msg = hash.ComputeHash(msg); BigInteger M = BigInteger.Abs(HashMd5.HashToBig(msg)); BigInteger S = BigInteger.ModPow(M, D, N); return(S); }