public ImageRgba32SteganographerBenchmarks()
        {
            _image            = Image.Load <Rgba32>("resources/images/drawing.png");
            _imageWithMessage = Image.Load <Rgba32>("resources/images/drawing.png");
            _message          = File.ReadAllText("resources/data/TenThousandWords.txt");

            _steganographer = ImageRgba32SteganographerBuilder.Default;
            _steganographer.EmbedMessage(_imageWithMessage, _message);
        }
예제 #2
0
        async Task ShouldBeAbleToEmbedAndExtractMessage(string imageName, string message)
        {
            var outputPath = $"{Environment.CurrentDirectory}/embedded-{imageName}";

            _output.WriteLine(outputPath);

            using var image = await Image.LoadAsync <Rgba32>($"resources/images/{imageName}");

            _sut.EmbedMessage(image, message);

            await image.SaveAsStegoAsync(outputPath);

            using var imageWithPayload = await Image.LoadAsync <Rgba32>(outputPath);

            var actualMessage = _sut.ExtractMessage(imageWithPayload);

            actualMessage.Should().Be(message);
        }
 public void EmbedMessage()
 {
     _steganographer.EmbedMessage(_image, _message);
 }