public static Geffe Create(string firstKeyStream, string secondKeyStream, string thirdKeyStream, string loadFilePath, string saveFilePath) { var initialFile = File.ReadAllBytes(loadFilePath); var firstKey = CipherHelpers.GenerateKey(firstKeyStream, initialFile.Length, new int[] { 27 }); var secondKey = CipherHelpers.GenerateKey(secondKeyStream, initialFile.Length, new int[] { 26, 19, 20 }); var thirdKey = CipherHelpers.GenerateKey(thirdKeyStream, initialFile.Length, new int[] { 25, 27, 35 }); var key = GenerateGeffeKey(firstKey, secondKey, thirdKey); var cipherFile = CipherHelpers.GenerateCipher(initialFile, key); var geffe = new Geffe(firstKey, secondKey, thirdKey, key, initialFile, cipherFile); File.WriteAllBytes(saveFilePath, geffe.CipherFile); return(geffe); }
private void Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(_saveFilePath) || string.IsNullOrWhiteSpace(_loadFilePath) || FirstKeyStream.Text.Length != 29 || SecondKeyStream.Text.Length != 27 || ThirdKeyStream.Text.Length != 37) { return; } var geffe = Geffe.Create(FirstKeyStream.Text, SecondKeyStream.Text, ThirdKeyStream.Text, _loadFilePath, _saveFilePath); PrintBits(geffe); }