[英]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.