예제 #1
0
        protected virtual BigInteger CalculateE(BigInteger n, byte[] message)
        {
            int messageBitLength = message.Length * 8;
            BigInteger trunc = new BigInteger(1, message);

            if (n.BitLength < messageBitLength)
            {
                trunc = trunc.ShiftRight(messageBitLength - n.BitLength);
            }

            return trunc;
        }
        private BigInteger BitsToInt(byte[] t)
        {
            BigInteger v = new BigInteger(1, t);

            if (t.Length * 8 > n.BitLength)
            {
                v = v.ShiftRight(t.Length * 8 - n.BitLength);
            }

            return v;
        }
 private BigInteger bits2int(byte[] @in)
 {
     BigInteger v = new BigInteger(1, @in);
     int vlen = @in.Length * 8;
     if(vlen > qlen)
     {
         v = v.ShiftRight(vlen - qlen);
     }
     return v;
 }