예제 #1
0
        static void Main(string[] args)
        {
            BigInteger p = new BigInteger("6277101735386680763835789423207666416083908700390324961279", 10);
            BigInteger a = new BigInteger("-3", 10);
            BigInteger b = new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16);

            byte[]     xG   = FromHexStringToByte("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012");
            BigInteger n    = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);
            DSGost     DS   = new DSGost(p, a, b, n, xG);
            BigInteger d    = DS.GenPrivateKey(192);
            ECPoint    Q    = DS.GenPublicKey(d);
            GOST       hash = new GOST(256);

            byte[] H      = hash.GetHash(Encoding.Default.GetBytes("Message"));
            string sign   = DS.SignGen(H, d);
            bool   result = DS.SignVer(H, sign, Q);

            Console.WriteLine(result);
        }
예제 #2
0
        static void Main(string[] args)
        {
            GOST G    = new GOST(256);
            GOST G512 = new GOST(512);

            byte[] message =
            {
                0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37,
                0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31,
                0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35,
                0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30
            };
            byte[] res  = G.GetHash(message);
            byte[] res2 = G512.GetHash(message);
            string h256 = BitConverter.ToString(res);
            string h512 = BitConverter.ToString(res2);

            Console.WriteLine(h256);
            Console.WriteLine();
            Console.WriteLine(h512);
            Console.ReadLine();
        }