コード例 #1
0
ファイル: Form1.cs プロジェクト: syrotynin/ECCGost
        private void button3_Click(object sender, EventArgs e)
        {
            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);
            GOST       hash  = new GOST(256);
            long       start = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond;

            byte[] H      = hash.GetHash(Encoding.Default.GetBytes(textBox1.Text));
            bool   result = DS.SingVer(H, textBox2.Text, Q);
            long   finish = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond;
            long   time   = finish - start;

            if (result)
            {
                label1.ForeColor = Color.Green;
                label1.Text      = "Correct";
            }
            else
            {
                label1.ForeColor = Color.Red;
                label1.Text      = "Wrong";
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: syrotynin/ECCGost
        private void button2_Click(object sender, EventArgs e)
        {
            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);

            d = DS.GenPrivateKey(192);
            Q = DS.GenPublicKey(d);
            GOST hash = new GOST(256);

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