directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: rev 57014 - incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/crypto
Date Tue, 09 Nov 2004 11:06:37 GMT
Author: erodriguez
Date: Tue Nov  9 03:06:35 2004
New Revision: 57014

Modified:
   incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/crypto/Confounder.java
Log:
Basic refactoring of Confounder, removed unused methods.

Modified: incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/crypto/Confounder.java
==============================================================================
--- incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/crypto/Confounder.java
(original)
+++ incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/crypto/Confounder.java
Tue Nov  9 03:06:35 2004
@@ -16,46 +16,25 @@
  */
 package org.apache.kerberos.crypto;
 
-import java.security.*;
+import java.security.SecureRandom;
 
-public class Confounder {
-	
+public class Confounder
+{
 	private static final SecureRandom random = new SecureRandom();
 	
-	public static synchronized byte[] bytes(int size) {
-		return bytes(size, false);
-	}
-	
-	public static synchronized byte[] bytes(int size, boolean testMode) {
-		
-		/*
-		 * Use setSeed call to improve unit test performance or else
-		 * the first call to SecureRandom may take a second.
-		 * 
-		 * TODO - consider removing testMode; in practice, I haven't found
-		 *        SecureRandom to start slowly at all
-		 */
-		if (testMode)
-			random.setSeed("testModeSeedString".getBytes());
-		
+	public static synchronized byte[] bytes(int size)
+    {
 		byte[] bytes = new byte[size];
 		random.nextBytes(bytes);
 		return bytes;
 	}
 
-	public static synchronized int intValue() {
+	public static synchronized int intValue()
+    {
 		byte[] data = Confounder.bytes(4);
 		int result = 0;
 		for (int i = 0; i < 4; i++)
 			result += data[i] * (16 ^ i);
-		return result;
-	}
-
-	public static synchronized long longValue() {
-		byte[] data = Confounder.bytes(4);
-		long result = 0;
-		for (int i = 0; i < 8; i++)
-			result += (data[i]) * (16L ^ i);
 		return result;
 	}
 }

Mime
View raw message