I'm working on a homework. I have this code which generates random strings with System.Random class.
public string GenerateString(int length)
{
const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
StringBuilder res = new StringBuilder();
Random rnd = new Random();
while (0 < length--){
res.Append(valid[rnd.Next(valid.Length)]);
}
return res.ToString();
}
What I have to do is: I need to write a brute force function which tries to find the string which is generated by GenerateString function
As far as I know, System.Random uses system time for seeding. Which is decreasing the surface of the brute force attack. But I'm not sure about the way should I follow. I think I need to do get the system time and seed my brute force function with that. But I'm not sure how to do this.
Aucun commentaire:
Enregistrer un commentaire