diff --git a/OpenSim.Framework/Remoting.cs b/OpenSim.Framework/Remoting.cs
index 88f559862c..12208fa995 100644
--- a/OpenSim.Framework/Remoting.cs
+++ b/OpenSim.Framework/Remoting.cs
@@ -72,9 +72,28 @@ namespace OpenSim.Framework
return currentHash;
}
+ ///
+ /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit messages generated using the Crytographic Random Number Generator.
+ ///
+ /// A 128-character hexadecimal string containing the challenge.
+ public static string GenerateChallenge()
+ {
+ RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
+ byte[] bytes = new byte[64];
+ RNG.GetBytes(bytes);
+
+ StringBuilder sb = new StringBuilder(bytes.Length * 2);
+ foreach (byte b in bytes)
+ {
+ sb.AppendFormat("{0:x2}", b);
+ }
+ return sb.ToString();
+ }
+
///
/// Helper function, merges two byte arrays
///
+ /// Sourced from MSDN Forum
/// A
/// B
/// C