public String HashParameters(Hashtable parameters, string nonce, UUID regionUUID)
{
StringBuilder concat = new StringBuilder();
//Ensure that the parameters are in the correct order
SortedList<string, string> sortedParameters = new SortedList<string, string>();
foreach(DictionaryEntry parameter in parameters)
{
sortedParameters.Add((string)parameter.Key, (string)parameter.Value);
}
foreach(KeyValuePair<string, string> de in sortedParameters)
{
concat.Append((string)de.Key + (string)de.Value);
}
String regionSecret = m_sceneHandler.GetRegionSecret(regionUUID);
String message = concat.ToString() + nonce + regionSecret;
SHA1 hashFunction = new SHA1Managed();
byte[] hashValue = hashFunction.ComputeHash(Encoding.UTF8.GetBytes(message));
string hashHex = "";
foreach(byte b in hashValue)
{
hashHex += String.Format("{0:x2}", b);
}
#if DEBUG
m_log.Debug(String.Format("[OMECONOMY] SHA1({0}) = {1}", message, hashHex));
#endif
return hashHex;
}