public static ShortHide5 FromString(string str) { List <string> list = new List <string>(); string temp = ""; for (int i = 0; i < str.Length; i++) { if (char.IsUpper(str[i]) && i > 0) { list.Add(temp); temp = str[i].ToString(); } else { temp += str[i]; } } list.Add(temp); ShortHide5 sh5 = new ShortHide5 { Factors = new byte[list.Count], Numbers = new long[list.Count] }; for (int i = 0; i < list.Count; i++) { sh5.Factors[i] = (byte)(list[i][0] - 'A' + 1); sh5.Numbers[i] = From36Hex(list[i].Substring(1)); } return(sh5); }
private static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("1. plaintext\n2. -d ciphertext\n3. -m plaintext [number]"); } else if (args.Length == 1) { Console.WriteLine(ShortHide5.Encrypt(args[0])); } else if (args.Length >= 2) { if (args[0] == "-d" || args[0] == "/d") { Console.WriteLine(ShortHide5.Decrypt(args[1])); } else if (args[0] == "-s" || args[0] == "/s") { Console.WriteLine(ShortHide5.FromString(args[1]).ToJson()); } else if (args[0] == "-m" || args[0] == "/m") { uint n = 15; if (args.Length > 2) { uint.TryParse(args[2], out n); } foreach (var item in new ShortHide5(args[1]).MuitiFindCast(n)) { Console.WriteLine(item); } } } }
public static string Decrypt(string str) { string[] strs = str.Split(','); string result = ""; foreach (var item in strs) { ShortHide5 sh5 = FromString(item); result += sh5.GetWord(); result += ' '; } return(result); }
public static string Encrypt(string str) { string[] strs = str.Trim().Split(new[] { ' ', ',', '.' }, StringSplitOptions.RemoveEmptyEntries); string result = ""; foreach (var item in strs) { ShortHide5 sh5 = new ShortHide5(item); sh5.FindFirstNumbers(); result += sh5.ToString(); result += ','; } return(result.Substring(0, result.Length - 1)); }