public void testEcDh()
        {
            byte[] p = new byte[32];
            byte[] q = null;
            byte[] n = new byte[32];

            p[0] = 100;
            n[0] = 100;

            n = curve25519.generatePrivateKey(n);

            for (int count = 0; count < 1000; count++)
            {
                q = curve25519.calculateAgreement(n, p);
                Array.Copy(q, 0, p, 0, 32);
                q = curve25519.calculateAgreement(n, p);
                Array.Copy(q, 0, n, 0, 32);
                n = curve25519.generatePrivateKey(n);
            }

            byte[] result = new byte[] {
                (byte)0xce, (byte)0xb4, (byte)0x4e, (byte)0xd6, (byte)0x4a,
                (byte)0xd4, (byte)0xc2, (byte)0xb5, (byte)0x43, (byte)0x9d,
                (byte)0x25, (byte)0xde, (byte)0xb1, (byte)0x10, (byte)0xa8,
                (byte)0xd7, (byte)0x2e, (byte)0xb3, (byte)0xe3, (byte)0x8e,
                (byte)0xf4, (byte)0x8a, (byte)0x42, (byte)0x73, (byte)0xb1,
                (byte)0x1b, (byte)0x4b, (byte)0x13, (byte)0x8d, (byte)0x17,
                (byte)0xf9, (byte)0x34
            };

            List <byte> qList      = new List <byte>(q);
            List <byte> resultList = new List <byte>(result);

            CollectionAssert.AreEqual(resultList, qList);
        }
 public byte[] calculateAgreement(byte[] ourPrivate, byte[] theirPublic)
 {
     return(native.calculateAgreement(ourPrivate, theirPublic));
 }