aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorDan Lake2011-07-11 12:23:20 -0700
committerDan Lake2011-07-11 12:23:20 -0700
commitb9cbe92f30c97d6b402be73c8c6fd8e6894ef05a (patch)
tree8fd2fa4567e2882e7f5dafdb8cf1de571917f23a /OpenSim/Framework/Util.cs
parentCheckin 32 bit bulletsim shared library for Linux. (diff)
parentminor Tack the prim name on the end of the "experimental mesh proxy generatio... (diff)
downloadopensim-SC_OLD-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.zip
opensim-SC_OLD-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.gz
opensim-SC_OLD-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.bz2
opensim-SC_OLD-b9cbe92f30c97d6b402be73c8c6fd8e6894ef05a.tar.xz
Merge branch 'master' into bulletsim
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs35
1 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e5ff27a..fce8999 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -324,10 +324,25 @@ namespace OpenSim.Framework
324 } 324 }
325 325
326 /// <summary> 326 /// <summary>
327 /// Debug utility function to convert OSD into formatted XML for debugging purposes.
328 /// </summary>
329 /// <param name="osd">
330 /// A <see cref="OSD"/>
331 /// </param>
332 /// <returns>
333 /// A <see cref="System.String"/>
334 /// </returns>
335 public static string GetFormattedXml(OSD osd)
336 {
337 return GetFormattedXml(OSDParser.SerializeLLSDXmlString(osd));
338 }
339
340 /// <summary>
327 /// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes. 341 /// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
328 ///
329 /// Please don't delete me even if I appear currently unused!
330 /// </summary> 342 /// </summary>
343 /// <remarks>
344 /// Please don't delete me even if I appear currently unused!
345 /// </remarks>
331 /// <param name="rawXml"></param> 346 /// <param name="rawXml"></param>
332 /// <returns></returns> 347 /// <returns></returns>
333 public static string GetFormattedXml(string rawXml) 348 public static string GetFormattedXml(string rawXml)
@@ -425,20 +440,30 @@ namespace OpenSim.Framework
425 } 440 }
426 441
427 /// <summary> 442 /// <summary>
428 /// Return an SHA1 hash of the given string 443 /// Return an SHA1 hash
429 /// </summary> 444 /// </summary>
430 /// <param name="data"></param> 445 /// <param name="data"></param>
431 /// <returns></returns> 446 /// <returns></returns>
432 public static string SHA1Hash(string data) 447 public static string SHA1Hash(string data)
433 { 448 {
449 return SHA1Hash(Encoding.Default.GetBytes(data));
450 }
451
452 /// <summary>
453 /// Return an SHA1 hash
454 /// </summary>
455 /// <param name="data"></param>
456 /// <returns></returns>
457 public static string SHA1Hash(byte[] data)
458 {
434 byte[] hash = ComputeSHA1Hash(data); 459 byte[] hash = ComputeSHA1Hash(data);
435 return BitConverter.ToString(hash).Replace("-", String.Empty); 460 return BitConverter.ToString(hash).Replace("-", String.Empty);
436 } 461 }
437 462
438 private static byte[] ComputeSHA1Hash(string src) 463 private static byte[] ComputeSHA1Hash(byte[] src)
439 { 464 {
440 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); 465 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
441 return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); 466 return SHA1.ComputeHash(src);
442 } 467 }
443 468
444 public static int fast_distance2d(int x, int y) 469 public static int fast_distance2d(int x, int y)