コード例 #1
0
ファイル: PngStegoUtil.cs プロジェクト: jujuka/nanoboard
        public void HideBytesInPng(Image innocuousBmp, string outputImageFileName, byte[] hiddenBytes)
        {
            hiddenBytes = ByteEncryptionUtil.EncryptSalsa20(hiddenBytes, _key);
            byte[] hiddenLengthBytes    = BitConverter.GetBytes(hiddenBytes.Length);
            byte[] hiddenCombinedBytes  = PngUtils.Combine(hiddenLengthBytes, hiddenBytes);
            byte[] rgbComponents        = PngUtils.RgbComponentsToBytes(innocuousBmp);
            byte[] encodedRgbComponents = EncodeBytes(hiddenCombinedBytes, rgbComponents);
            Bitmap encodedBmp           = PngUtils.ByteArrayToBitmap(encodedRgbComponents, innocuousBmp.Width, innocuousBmp.Height);

            encodedBmp.Save(outputImageFileName, ImageFormat.Png);
            encodedBmp.Dispose();
            innocuousBmp.Dispose();
        }
コード例 #2
0
ファイル: PngStegoUtil.cs プロジェクト: Karasiq/nanoboard-1
        public void HideBytesInPng(Image innocuousBmp, string outputImageFileName, byte[] hiddenBytes)
        {
            byte[] hiddenLengthBytes    = BitConverter.GetBytes(hiddenBytes.Length);
            byte[] hiddenCombinedBytes  = PngUtils.Combine(hiddenLengthBytes, hiddenBytes);
            byte[] rgbComponents        = PngUtils.RgbComponentsToBytes(innocuousBmp);
            byte[] encodedRgbComponents = EncodeBytes(hiddenCombinedBytes, rgbComponents);
            Bitmap encodedBmp           = PngUtils.ByteArrayToBitmap(encodedRgbComponents, innocuousBmp.Width, innocuousBmp.Height);

            encodedBmp.Save(outputImageFileName, ImageFormat.Png);
            encodedBmp.Dispose();
            innocuousBmp.Dispose();
            Console.WriteLine("Saved as " + outputImageFileName);
            return;
        }