public string Encode(string src, ISecretMessage message, int passHash, int lsbIndicator = 3) { if (string.IsNullOrEmpty(src)) { throw new ArgumentNullException(nameof(src)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } if (lsbIndicator < 0 || lsbIndicator > 8) { throw new ArgumentException(nameof(lsbIndicator)); } InitializeEncoding(src, message, passHash, lsbIndicator); if (!IsEncryptionPossible()) { CleanupEncoding(); throw new ContentLengthException(); } if (!DoesCoverFitType()) { CleanupEncoding(); throw new BadImageFormatException(); } var result = EncodingAlgorithm(src, message); CleanupEncoding(); return result; }
public string Encode(string src, ISecretMessage message, int passHash, int lsbIndicator = 3) { if (string.IsNullOrEmpty(src)) { throw new ArgumentNullException(nameof(src)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } if (lsbIndicator < 0 || lsbIndicator > 8) { throw new ArgumentException(nameof(lsbIndicator)); } InitializeEncoding(src, message, passHash, lsbIndicator); if (!IsEncryptionPossible()) { CleanupEncoding(); throw new ContentLengthException(); } if (!DoesCoverFitType()) { CleanupEncoding(); throw new BadImageFormatException(); } var result = EncodingAlgorithm(src, message); CleanupEncoding(); return(result); }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); LsbIndicator = lsbIndicator; BitIndex = 0; ByteIndex = 0; Bytes = message.Convert(); }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var data = message.Convert(); var file = FileManager.CopyImageToTmp(src); using (var sw = new StreamWriter(File.Open(file, FileMode.Append))) { sw.Write("\n"); sw.Write("\n"); sw.Write("\n"); sw.Write(ConvertHelper.Convert(data)); } return file; }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var data = message.Convert(); var file = FileManager.CopyImageToTmp(src); using (var sw = new StreamWriter(File.Open(file, FileMode.Append))) { sw.Write("\n"); sw.Write("\n"); sw.Write("\n"); sw.Write(ConvertHelper.Convert(data)); } return(file); }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var tmp = FileManager.CopyImageToTmp(src); using (var bmp = new Bitmap(src)) { var item = bmp.PropertyItems.OrderByDescending(x => x.Id).First(); item.Id = item.Id + 1; item.Len = Bytes.Length; item.Value = Bytes; item.Type = 1; bmp.SetPropertyItem(item); bmp.Save(tmp); } return tmp; }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var tmp = FileManager.CopyImageToTmp(src); using (var bmp = new Bitmap(src)) { var item = bmp.PropertyItems.OrderByDescending(x => x.Id).First(); item.Id = item.Id + 1; item.Len = Bytes.Length; item.Value = Bytes; item.Type = 1; bmp.SetPropertyItem(item); bmp.Save(tmp); } return(tmp); }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); var filter = new Laplace(Bitmap, LsbIndicator, 8); IDictionary <Pixel, int> filtered = new Dictionary <Pixel, int>(); for (var x = 0; x < Bitmap.Width; x++) { for (var y = 0; y < Bitmap.Height; y++) { filtered.Add(new Pixel(x, y), filter.GetValue(x, y)); } } var ordered = filtered.OrderByDescending(key => key.Value); mLaplaceValues = ordered; }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var tmp = FileManager.CopyImageToTmp(src); try { if (!EncodingIteration()) { throw new SystemException(); } } finally { Cleanup(); Bitmap.Source.Save(tmp); } return(tmp); }
protected virtual void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { Bitmap = LockBitmap(src); PassHash = passHash; }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); GenerateShips(); }
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var palette = Bitmap.Source.Palette; throw new NotImplementedException(); }
protected abstract string EncodingAlgorithm(string src, ISecretMessage message);
protected override string EncodingAlgorithm(string src, ISecretMessage message) { var tmp = FileManager.CopyImageToTmp(src); try { if (!EncodingIteration()) { throw new SystemException(); } } finally { Cleanup(); Bitmap.Source.Save(tmp); } return tmp; }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); var filter = new Laplace(Bitmap, LsbIndicator, 8); IDictionary<Pixel, int> filtered = new Dictionary<Pixel, int>(); for (var x = 0; x < Bitmap.Width; x++) { for (var y = 0; y < Bitmap.Height; y++) { filtered.Add(new Pixel(x, y), filter.GetValue(x, y)); } } var ordered = filtered.OrderByDescending(key => key.Value); mLaplaceValues = ordered; }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); mPixels = new HashSet <Pixel>(); Random = new Random(PassHash); }
protected override void InitializeEncoding(string src, ISecretMessage message, int passHash, int lsbIndicator) { base.InitializeEncoding(src, message, passHash, lsbIndicator); mPixels = new HashSet<Pixel>(); Random = new Random(PassHash); }