예제 #1
0
 public ElGamalCiphertext(Point c1, Point c2)
     : base(c1.ToByteArray(), c2.ToByteArray())
 {
     _c1 = c1;
     _c2 = c2;
 }
예제 #2
0
        public void ToByteArrayTest()
        {
            Point target = new Point
            {
                X = 1.23,
                Y = 2.34
            };

            byte[] actual;
            actual = target.ToByteArray();

            MemoryStream stream = new MemoryStream();
            stream.Write(BitConverter.GetBytes(1.23), 0, sizeof(double));
            stream.Write(BitConverter.GetBytes(2.34), 0, sizeof(double));
            byte[] expected = stream.ToArray();

            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }