日期:2014-05-17  浏览次数:20866 次

C#制作字典
用C#制作一个密码字典,自动列决一个单词的变形,比如password,列决出passw0rd PassWord等等。

请问有没有思路?

------解决方案--------------------
password,列决出passw0rd PassWord,如果是仅仅这样的话,可以定义一个函数,随机的对单词的某一位进行ToUpper操作。
------解决方案--------------------
枚举相近的单词:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<List<char>> simchr = new List<List<char>>()
            { 
                new List<char>() { '0', 'o' },
                new List<char>() { '2', 'z' },
                new List<char>() { 'g', 'q', '9' }
            };
            string source = "22az9";
            string source1 = string.Join("", source.Select((x, i) => simchr.Any(y => y.Any(z => z == x)) ? "{" + simchr.Single(y => y.Any(z => z == x)).FirstOrDefault() + ":" + i.ToString() + "}" : x.ToString()));
            IEnumerable<string> query = new string[] { source1 };
            while (Regex.IsMatch(query.First(), @"\{\w:\d+\}"))
            {