summary refs log tree commit diff
path: root/crypto/src/util/Strings.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 14:51:32 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 14:51:32 +0700
commit31525ff4a76773fa0cc85d4abcee7d5418cbd984 (patch)
tree0c3fa4c3b580f68c58f1476502fdaa1d25ec44f4 /crypto/src/util/Strings.cs
parentBring Fp field element code mostly up-to-date with Java version (diff)
downloadBouncyCastle.NET-ed25519-31525ff4a76773fa0cc85d4abcee7d5418cbd984.tar.xz
Make static utility classes abstract instead of sealed
Add Arrays.GetHashCode for int[]
Formatting
Diffstat (limited to 'crypto/src/util/Strings.cs')
-rw-r--r--crypto/src/util/Strings.cs86
1 files changed, 41 insertions, 45 deletions
diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs
index 96032bdc5..a6080f427 100644
--- a/crypto/src/util/Strings.cs
+++ b/crypto/src/util/Strings.cs
@@ -3,33 +3,29 @@ using System.Text;
 
 namespace Org.BouncyCastle.Utilities
 {
-	/// <summary> General string utilities.</summary>
-	public sealed class Strings
-	{
-		private Strings()
-		{
-		}
-
-		internal static bool IsOneOf(string s, params string[] candidates)
-		{
-			foreach (string candidate in candidates)
-			{
-				if (s == candidate)
-					return true;
-			}
-			return false;
-		}
+    /// <summary> General string utilities.</summary>
+    public abstract class Strings
+    {
+        internal static bool IsOneOf(string s, params string[] candidates)
+        {
+            foreach (string candidate in candidates)
+            {
+                if (s == candidate)
+                    return true;
+            }
+            return false;
+        }
 
-		public static string FromByteArray(
-			byte[] bs)
-		{
-			char[] cs = new char[bs.Length];
-			for (int i = 0; i < cs.Length; ++i)
-			{
-				cs[i] = Convert.ToChar(bs[i]);
-			}
-			return new string(cs);
-		}
+        public static string FromByteArray(
+            byte[] bs)
+        {
+            char[] cs = new char[bs.Length];
+            for (int i = 0; i < cs.Length; ++i)
+            {
+                cs[i] = Convert.ToChar(bs[i]);
+            }
+            return new string(cs);
+        }
 
         public static byte[] ToByteArray(
             char[] cs)
@@ -43,15 +39,15 @@ namespace Org.BouncyCastle.Utilities
         }
 
         public static byte[] ToByteArray(
-			string s)
-		{
-			byte[] bs = new byte[s.Length];
-			for (int i = 0; i < bs.Length; ++i)
-			{
-				bs[i] = Convert.ToByte(s[i]);
-			}
-			return bs;
-		}
+            string s)
+        {
+            byte[] bs = new byte[s.Length];
+            for (int i = 0; i < bs.Length; ++i)
+            {
+                bs[i] = Convert.ToByte(s[i]);
+            }
+            return bs;
+        }
 
         public static string FromAsciiByteArray(
             byte[] bytes)
@@ -87,10 +83,10 @@ namespace Org.BouncyCastle.Utilities
         }
 
         public static string FromUtf8ByteArray(
-			byte[] bytes)
-		{
-			return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
-		}
+            byte[] bytes)
+        {
+            return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
+        }
 
         public static byte[] ToUtf8ByteArray(
             char[] cs)
@@ -98,10 +94,10 @@ namespace Org.BouncyCastle.Utilities
             return Encoding.UTF8.GetBytes(cs);
         }
 
-		public static byte[] ToUtf8ByteArray(
-			string s)
-		{
-			return Encoding.UTF8.GetBytes(s);
-		}
-	}
+        public static byte[] ToUtf8ByteArray(
+            string s)
+        {
+            return Encoding.UTF8.GetBytes(s);
+        }
+    }
 }