private string DEC_Step1(System.Collections.Generic.List <int> tmp) { System.Collections.Generic.Dictionary <int, char> map = new Dictionary <int, char>(); int key = 0; int i = 0; for (i = 0; i < tmp.Count; i++) { if (tmp[i] == 0) { break; } } UniKey k = new UniKey(1, i, new Key(__key)); for (int j = 0; j < i; j++) { map.Add(k.Gen(), CONVERT.sym(tmp[j])); } string res = ""; for (int j = i + 1; j < tmp.Count; j++) { if (tmp[j] == 0) { break; } res += map[tmp[j]]; } return(res); }
private System.Collections.Generic.List <int> ENC_Step1(string str) { System.Collections.Generic.List <int> res = new List <int>(); System.Collections.Generic.Dictionary <char, int> map = new Dictionary <char, int>(); for (int i = 0; i < str.Length; i++) { if (!map.ContainsKey(str[i])) { map.Add(str[i], 0); } } _map_C = map.Count; UniKey k = new UniKey(1, map.Count, _key); for (int i = 0; i < map.Count; i++) { KeyValuePair <char, int> t = map.ElementAt(i); int tmo = k.Gen(); map[t.Key] = tmo; res.Add(CONVERT.ord(t.Key)); } res.Add(0); for (int i = 0; i < str.Length; i++) { res.Add(map[str[i]]); } return(res); }