summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-08-28 09:57:18 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-08-28 09:57:18 +0700
commit8cd5e10893ca5d825458c2d4938aa205d13e8c49 (patch)
tree6c3b07d18e3dc2c82870d03df723ac77b05cdaf4 /crypto
parentMinor improvements to MaxFragmentLength handling (diff)
downloadBouncyCastle.NET-ed25519-8cd5e10893ca5d825458c2d4938aa205d13e8c49.tar.xz
Small refactoring
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/agreement/DHStandardGroups.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/src/crypto/agreement/DHStandardGroups.cs b/crypto/src/crypto/agreement/DHStandardGroups.cs
index 6c46b60de..93b65af98 100644
--- a/crypto/src/crypto/agreement/DHStandardGroups.cs
+++ b/crypto/src/crypto/agreement/DHStandardGroups.cs
@@ -9,19 +9,19 @@ namespace Org.BouncyCastle.Crypto.Agreement
     /// <summary>Standard Diffie-Hellman groups from various IETF specifications.</summary>
     public class DHStandardGroups
     {
+        private static BigInteger FromHex(string hex)
+        {
+            return new BigInteger(1, Hex.Decode(hex));
+        }
+
         private static DHParameters FromPG(string hexP, string hexG)
         {
-            BigInteger p = new BigInteger(1, Hex.Decode(hexP));
-            BigInteger g = new BigInteger(1, Hex.Decode(hexG));
-            return new DHParameters(p, g);
+            return new DHParameters(FromHex(hexP), FromHex(hexG));
         }
 
         private static DHParameters FromPGQ(string hexP, string hexG, string hexQ)
         {
-            BigInteger p = new BigInteger(1, Hex.Decode(hexP));
-            BigInteger g = new BigInteger(1, Hex.Decode(hexG));
-            BigInteger q = new BigInteger(1, Hex.Decode(hexQ));
-            return new DHParameters(p, g, q);
+            return new DHParameters(FromHex(hexP), FromHex(hexG), FromHex(hexQ));
         }
 
         /*