/// <summary> /// Шифрование текста комбинация 1 /// </summary> /// <param name="N0"> исходный текст </param> /// <returns></returns> public static string EnCombo1(string N0) { List <int> S1(string _N0) { List <int> code = new List <int>(); foreach (char i in _N0) { code.Add(NT117.indexSymNT117(i)); } return(code); } List <string> T1(List <int> _S1) { List <string> S1T1 = new List <string>(); foreach (int i in _S1) { S1T1.Add(Trinary.To3(i)); } return(S1T1); } List <string> F1(List <string> _T1) { List <string> _R0 = new List <string>(); char c = '0'; string b1 = "|"; string b2; char r = 'k'; int z = 1; foreach (string i in _T1) { if (z >= 10) { z++; if (z <= 10) { z = 1; } } foreach (char j in i) { if (c == j) { z++; r = (char)new Random().Next('a', 'z' + z); b1 = b1.Replace(b1[0], r); break; } else { b1 = "|"; } } b2 = NT117.symIndex_NT177(Trinary.Back3(i)).ToString(); if (b1 != "|") { _R0.Add(b2 + b1); } else { _R0.Add(b2); } } return(_R0); } string R0(List <string> _F1) { string b = ""; foreach (string i in _F1) { b += i; } return(b); } return(R0(F1(T1(S1(N0))))); }
/// <summary> /// Дешифрование текста комбинация 1 /// </summary> /// <param name="R0"> исходный текст </param> /// <returns></returns> public static string DeCombo1(string R0) { List <int> S1(string _N0) { List <int> code = new List <int>(); foreach (char i in _N0) { code.Add(NT117.indexSym_NT117(i)); } return(code); } List <string> T1(List <int> _S1) { List <string> S1T1 = new List <string>(); foreach (int i in _S1) { S1T1.Add(Trinary.To3(i)); } return(S1T1); } List <string> F1(List <string> _T1) { List <string> _N0 = new List <string>(); int i_ = 0; bool t = false; for (int i = 0; i < _T1.Count;) { if (_T1.Count > i) { for (int j = 0; _T1[i].Length > j; j++) { if (_T1[i][j] == '0') { t = true; break; } else { t = false; } } if (t == true) { _N0.Add(_T1[i]); i += 2; } else { _N0.Add(_T1[i]); i++; } } i_++; } return(_N0); } string N0(List <string> _F1) { string n0 = ""; foreach (string i in _F1) { n0 += NT117.symIndexNT177(Trinary.Back3(i)).ToString(); } return(n0); } return(N0(F1(T1(S1(R0))))); }