I am a student at university and our task is to create a search engine. I am having difficulty generating a unique id to assign to each url when added into the frontier. I have attempted using the SHA-256 hashing algorithm as well as Guid. Here is the code that i used to implement the guid:
public string generateID(string url_add)
{
long i = 1;
foreach (byte b in Guid.NewGuid().ToByteArray())
{
i *= ((int)b + 1);
}
string number = String.Format("{0:d9}", (DateTime.Now.Ticks / 10) % 1000000000);
return number;
}
return url_add;
– Oosperm