public static Lfsr Create(string key, string loadFilePath, string saveFilePath) { var initialFile = File.ReadAllBytes(loadFilePath); var lfsrKey = CipherHelpers.GenerateKey(key, initialFile.Length, new[] { 27 }); var cipherFile = CipherHelpers.GenerateCipher(initialFile, lfsrKey); var lfsr = new Lfsr(lfsrKey, initialFile, cipherFile); File.WriteAllBytes(saveFilePath, lfsr.CipherFile); return(lfsr); }
private void Button_Click_LFSR(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(_saveFilePath) || string.IsNullOrWhiteSpace(_loadFilePath) || LFSRKey.Text.Length != 29) { return; } var lfsr = Lfsr.Create(LFSRKey.Text, _loadFilePath, _saveFilePath); PrintBits(lfsr); }