예제 #1
0
        internal static byte[] ComputeKey(BigInteger secretA,
                                          BigInteger sharedA,
                                          BigInteger sharedB,
                                          ClientInfo clientInfo,
                                          Session session)
        {
            // Some arbitrary crypto computation, variable names don't have much meaning
            var ab     = sharedA.ToHex() + sharedB.ToHex();
            var hashAb = Crypto.Sha256(ab).ToBigInt();
            var s      = session.Id.ToBytes().ToBigInt();
            var x      = ComputeX(clientInfo, session);
            var y      = sharedB - SirpG.ModExp(x, SirpN) * s;
            var z      = y.ModExp(secretA + hashAb * x, SirpN);

            return(Crypto.Sha256(z.ToHex()));
        }
예제 #2
0
 internal static BigInteger ComputeSharedA(BigInteger secretA)
 {
     return(SirpG.ModExp(secretA, SirpN));
 }