private void Encrypt() { HandleJobController.Progress(() => { //TODO compression var message = GetCurrentMessage(); var algorithm = ViewModel.CryptionModel.Algorithm as RsaAlgorithm; EncodeModel model; if (algorithm != null) { string key; using (var sr = new StreamReader(ViewModel.CryptionModel.KeyFilePath)) { key = sr.ReadToEnd(); } model = new EncodeModel(ViewModel.ImagePath, message, ViewModel.CryptionModel.Algorithm, key, ViewModel.SteganographicModel.Algorithm, ViewModel.SteganographicModel.Compression, ViewModel.SteganographicModel.LsbIndicator); } else { model = new EncodeModel(ViewModel.ImagePath, message, ViewModel.CryptionModel.Algorithm, ViewModel.CryptionModel.Password, ViewModel.SteganographicModel.Algorithm, ViewModel.SteganographicModel.Compression, ViewModel.SteganographicModel.LsbIndicator); } var result = model.Encode(); ViewModel.Result = result; }); }
private string Encode(string src, string message, CryptographicAlgorithmImpl crypt = null, string password = null, bool compression = false, int lsbIndicator = 3) { var model = new EncodeModel(src, message, crypt, password, Algorithm, compression, lsbIndicator); mStopwatch.Start(); var result = model.Encode(); mStopwatch.Stop(); mEncryptionTime = mStopwatch.Elapsed; mStopwatch.Reset(); return(result); }
protected override void RunWithParameters() { if (Configured) { InitializeRun(); //TODO Show process? var model = new EncodeModel(mImagePath, mMessage, GetCrypt(mCryptIndex), mPassword, GetStego(mStegoIndex), mCompression, mLsbIndicator); var result = model.Encode(); Console.WriteLine(); if (result != null) { Console.WriteLine("ENCODING successfully. Please enter a path to save:"); var path = Console.ReadLine(); File.Move(result, mResultPath); Console.WriteLine("Image saved at " + path); } Console.WriteLine("Press <ENTER> to exit."); Console.ReadLine(); } }
private Encoding checkBom(EncodeModel model, byte[] topBytes) { var bom = model.Bom; if (bom == null || bom.Length == 0 || bom.Length >= topBytes.Length) { return(model.Encoding); } else { //BOMチェック for (int i = 0; i < bom.Length; ++i) { if (bom[i] != topBytes[i]) { return(model.Encoding); } } return(model.EncodingWithBom); } }
public ModeIndex(EncodeModel model, int priority) { Model = model; Index = 0; Score = 0; }
public ModeIndex(EncodeModel model) : this(model, 1000) { }