暴力破解算法
2012-05-18 17:03:48 来源:WEB开发网核心提示:static void Main(string[] args) { Console.WriteLine(DateTime.Now.Ticks); int maxLength = 10; CrackPass(maxLength);
static void Main(string[] args) { Console.WriteLine(DateTime.Now.Ticks); int maxLength = 10; CrackPass(maxLength); Console.WriteLine(DateTime.Now.Ticks); Console.Read(); } static char[] charSource = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; static int sLength = charSource.Length; private static void Crack(char[] list, int len) { if (len == 0) { Console.WriteLine(ArrayToString(list)); } else { for (int i = 0; i < sLength; i++) { list[len - 1] = charSource[i]; Crack(list, len - 1); } } } private static string ArrayToString(char[] list) { if (list == null||list.Length == 0) return string.Empty; StringBuilder buider = new StringBuilder(list.Length*2); for (int i = 0; i < list.Length; i++) { buider.Append(list[i]); } return buider.ToString(); } public static void CrackPass(int maxLength) { for (int i = 0; i < maxLength; i++) { char[] list =new char[i]; Crack(list, i); } }
- ››暴力破解算法
- ››暴力测试!黄昱子网划分计算工具V2.0
- ››算法大全(3) 二叉树
- ››算法
- ››算法从哪学起
更多精彩
赞助商链接