コード例 #1
0
ファイル: Program.cs プロジェクト: surifoll/Steganography.Api
        private static void Input()
        {
            // Declare the password that will allow you to retrieve the encrypted data later
            var _PASSWORD = "******";

            // The String data to conceal on the image
            var _DATA_TO_HIDE = "Hello, no one should know that my password is 12345";

            // Declare the path where the original image is located
            var pathOriginalImage =
                @"/Users/surajfehintola/RiderProjects/Steganography/Steganography.ConsoleApplication/img/screen.png";
            // Declare the new name of the file that will be generated with the hidden information
            var pathResultImage =
                @"/Users/surajfehintola/RiderProjects/Steganography/Steganography.ConsoleApplication/img/image_example_with_hidden_information.png";

            // Create an instance of the SteganographyHelper
            var helper = new SteganographyHelper();

            // Encrypt your data to increase security
            // Remember: only the encrypted data should be stored on the image
            var encryptedData = StringCipher.Encrypt(_DATA_TO_HIDE, _PASSWORD);

            // Create an instance of the original image without indexed pixels
            var originalImage = SteganographyHelper.CreateNonIndexedImage(Image.FromFile(pathOriginalImage));
            // Conceal the encrypted data on the image !
            var imageWithHiddenData = SteganographyHelper.MergeText(encryptedData, originalImage);

            // Save the image with the hidden information somewhere :)
            // In this case the generated file will be image_example_with_hidden_information.png
            imageWithHiddenData.Save(pathResultImage);
        }
コード例 #2
0
        public static string Hide2(DataModel data, Image file, string filePath, string _PASSWORD,
                                   string filePathResult)
        {
            file.Save(filePath, ImageFormat.Png);
            // Encrypt your data to increase security
            // Remember: only the encrypted data should be stored on the image
            var encryptedData = StringCipher.Encrypt(data.Info, _PASSWORD);

            // Create an instance of the original image without indexed pixels
            var originalImage = SteganographyHelper.CreateNonIndexedImage(file);
            // Conceal the encrypted data on the image !
            var imageWithHiddenData = SteganographyHelper.MergeText(encryptedData, originalImage);

            // Save the image with the hidden information somewhere :)
            // In this case the generated file will be image_example_with_hidden_information.png
            imageWithHiddenData.Save(filePathResult);

            return("");
        }