![](/img/trans.png)
[英]Is there a way I can find out if a string in C# does not contain the numbers & characters 0-9 and A-Z?
[英]How can I create a dictionary with a-z and 0-9 up to 8 characters long and save it as a .txt file?
我和一个朋友一直在搞弄这个问题,并且经过大量的研究,我仍然无法弄清楚这一点,因为我对c#一无所知。 到目前为止,这是
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
for (int length = 8; length > 0; length--)
{
var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
var q = alphabet.Select(x => x.ToString());
int size = length;
for (int i = 0; i < size - 1; i++)
q = q.SelectMany(x => alphabet, (x, y) => x + y);
foreach (var item in q)
Console.WriteLine(item);
}
}
}
} //namespace end
它创建了我们想要的所有东西(我相信),但是我们唯一的问题是我们不确定如何保存它。 可能是由于睡眠不足,但我们无法解决。
谢谢!
看到此链接,它说明了如何写入文本文件
http://msdn.microsoft.com/zh-CN/library/aa287548(v=vs.71).aspx
如果您只是用它来创建彩虹表,则可能只想下载一个合适的表: http : //project-rainbowcrack.com/table.htm
using System.IO;
例:
int number;
StreamWriter sw = new StreamWriter("C:/[yourpath]");
for(i = 0; i < number; i++)
{
sw.WriteLine(i);
}
这是一个例子..把它变成你的! 我想知道更新! 也许您会做的更好或更高级!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.