aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorroot2011-07-09 01:06:46 +0100
committerroot2011-07-09 01:06:46 +0100
commitc920ff9d1d5840fb6b36efd46e8bec431cc5d15f (patch)
tree4b804cf4255f4a8eaa2789cce97154a418f6e0b5 /OpenSim/Framework/Util.cs
parentRemove another core SNAFU. AbsolutePosition is NOT equal to group position (diff)
parentInstance-types-in-list fix for LSL/OSSL functions. This will fix llListFindLi... (diff)
downloadopensim-SC-c920ff9d1d5840fb6b36efd46e8bec431cc5d15f.zip
opensim-SC-c920ff9d1d5840fb6b36efd46e8bec431cc5d15f.tar.gz
opensim-SC-c920ff9d1d5840fb6b36efd46e8bec431cc5d15f.tar.bz2
opensim-SC-c920ff9d1d5840fb6b36efd46e8bec431cc5d15f.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs41
1 files changed, 33 insertions, 8 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5ace351..b8b1039 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)
@@ -431,26 +446,36 @@ namespace OpenSim.Framework
431 } 446 }
432 447
433 /// <summary> 448 /// <summary>
434 /// Return an SHA1 hash of the given string 449 /// Return an SHA1 hash
435 /// </summary> 450 /// </summary>
436 /// <param name="data"></param> 451 /// <param name="data"></param>
437 /// <returns></returns> 452 /// <returns></returns>
438 453
454 public static string SHA1Hash(string data, Encoding enc)
455 {
456 return SHA1Hash(enc.GetBytes(data));
457 }
458
439 public static string SHA1Hash(string data) 459 public static string SHA1Hash(string data)
440 { 460 {
441 return SHA1Hash(data, Encoding.Default); 461 return SHA1Hash(Encoding.Default.GetBytes(data));
442 } 462 }
443 463
444 public static string SHA1Hash(string data, Encoding encoding) 464 /// <summary>
465 /// Return an SHA1 hash
466 /// </summary>
467 /// <param name="data"></param>
468 /// <returns></returns>
469 public static string SHA1Hash(byte[] data)
445 { 470 {
446 byte[] hash = ComputeSHA1Hash(data, encoding); 471 byte[] hash = ComputeSHA1Hash(data);
447 return BitConverter.ToString(hash).Replace("-", String.Empty); 472 return BitConverter.ToString(hash).Replace("-", String.Empty);
448 } 473 }
449 474
450 private static byte[] ComputeSHA1Hash(string src, Encoding encoding) 475 private static byte[] ComputeSHA1Hash(byte[] src)
451 { 476 {
452 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); 477 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
453 return SHA1.ComputeHash(encoding.GetBytes(src)); 478 return SHA1.ComputeHash(src);
454 } 479 }
455 480
456 public static int fast_distance2d(int x, int y) 481 public static int fast_distance2d(int x, int y)