コード例 #1
0
        public void ExtractTest(string msg, string bitmapName)
        {
            var stegoBitmapPath  = BitmapsDir + bitmapName + StegoSuffix + BitmapExt;
            var pixels           = Stego.ReadBitmap(stegoBitmapPath);
            var expectedMsgBytes = Stego.Extract(pixels, msg.Length);

            var actualMsgBytes = new byte[msg.Length];

            Extract(pixels, actualMsgBytes, msg.Length);

            CollectionAssert.AreEqual(expectedMsgBytes, actualMsgBytes);
        }
コード例 #2
0
        public void EmbedTest(string msg, string bitmapName)
        {
            var msgBytes        = Encoding.ASCII.GetBytes(msg);
            var bitmapPath      = BitmapsDir + bitmapName + BitmapExt;
            var stegoBitmapPath = BitmapsDir + bitmapName + StegoSuffix + BitmapExt;

            var pixels         = Stego.ReadBitmap(bitmapPath);
            var expectedPixels = Stego.Embed(pixels, msgBytes);

            Stego.WriteBitmap(expectedPixels, bitmapPath, stegoBitmapPath);

            Embed(pixels, msgBytes, msgBytes.Length);

            CollectionAssert.AreEqual(expectedPixels, pixels);
        }