public List <string> Generate(string dic, int length)
        {
            var result = new List <string>();
            var seed   = new string(dic[0], length);

            while (!string.IsNullOrEmpty(seed))
            {
                result.Add(seed);

                seed = FixedPointCombinator(
                    x =>
                {
                    if (x != null)
                    {
                        return((s, idx, idc) =>
                        {
                            if (idx < 0 || idx >= s.Length)
                            {
                                return null;
                            }

                            char c = s[idx];
                            if (dic.IndexOf(c) < dic.Length - 1)
                            {
                                c = dic[dic.IndexOf(c) + 1];
                                s = s.Substring(0, idx) + c + s.Substring(idx + 1, s.Length - 1 - idx);
                            }
                            else
                            {
                                c = dic[0];
                                s = s.Substring(0, idx) + c + s.Substring(idx + 1, s.Length - 1 - idx);
                                s = x(s, idx - 1, dic);
                            }

                            return s;
                        });
                    }

                    return(null);
                })(seed, seed.Length - 1, dic);
            }

            return(result);
        }
        public List <string> Generate(string dic, int length)
        {
            var result = new List <string>();

            unsafe
            {
                IntPtr p    = Marshal.AllocHGlobal(sizeof(char));
                var    seed = (char *)p.ToPointer();
                int    i    = 0;
                for (; i < length; i++)
                {
                    *(seed + i) = dic[0];
                }
                *(seed + i) = '\0';

                bool tmp = true;
                while (tmp)
                {
                    result.Add(new string(seed));
                    tmp = FixedPointCombinator(
                        x =>
                    {
                        if (x != null)
                        {
                            return((s) =>
                            {
                                int len = 0;
                                for (; *(s.Seed + len) != '\0'; len++)
                                {
                                }
                                if (s.Idx < 0 || s.Idx >= len)
                                {
                                    return false;
                                }

                                char c = s.Seed[s.Idx];
                                if (s.Dic.IndexOf(c) < s.Dic.Length - 1)
                                {
                                    c = s.Dic[s.Dic.IndexOf(c) + 1];
                                    *(s.Seed + s.Idx) = c;
                                    return true;
                                }
                                else
                                {
                                    c = s.Dic[0];
                                    *(s.Seed + s.Idx) = c;
                                    s.Idx--;
                                    return x(s);
                                }
                            });
                        }

                        return(null);
                    })(new Args()
                    {
                        Seed = seed, Idx = length - 1, Dic = dic
                    });
                }
            }

            return(result);
        }