From 8cd5e10893ca5d825458c2d4938aa205d13e8c49 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 28 Aug 2014 09:57:18 +0700 Subject: Small refactoring --- crypto/src/crypto/agreement/DHStandardGroups.cs | 14 +++++++------- 1 file 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 /// Standard Diffie-Hellman groups from various IETF specifications. 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)); } /* -- cgit 1.4.1