diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Util.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index c5c4ab3..e12d37a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -864,11 +864,24 @@ namespace OpenSim.Framework | |||
864 | private static byte[] ComputeSHA1Hash(byte[] src) | 864 | private static byte[] ComputeSHA1Hash(byte[] src) |
865 | { | 865 | { |
866 | byte[] ret; | 866 | byte[] ret; |
867 | using(SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider()) | 867 | using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider()) |
868 | ret = SHA1.ComputeHash(src); | 868 | ret = SHA1.ComputeHash(src); |
869 | return ret; | 869 | return ret; |
870 | } | 870 | } |
871 | 871 | ||
872 | public static UUID ComputeSHA1UUID(string src) | ||
873 | { | ||
874 | return ComputeSHA1UUID(Encoding.Default.GetBytes(src)); | ||
875 | } | ||
876 | |||
877 | public static UUID ComputeSHA1UUID(byte[] src) | ||
878 | { | ||
879 | byte[] ret; | ||
880 | using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider()) | ||
881 | ret = SHA1.ComputeHash(src); | ||
882 | return new UUID(ret, 2); | ||
883 | } | ||
884 | |||
872 | public static int fast_distance2d(int x, int y) | 885 | public static int fast_distance2d(int x, int y) |
873 | { | 886 | { |
874 | x = Math.Abs(x); | 887 | x = Math.Abs(x); |