r26602 - trunk/freenet/src/freenet/crypt

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-07 15:04:29 +0000 (Tue, 07 Apr 2009)
New Revision: 26602

Modified:
   trunk/freenet/src/freenet/crypt/Yarrow.java
Log:
Aggregate MessageDigest.update() calls

Modified: trunk/freenet/src/freenet/crypt/Yarrow.java
===================================================================
--- trunk/freenet/src/freenet/crypt/Yarrow.java	2009-04-07 12:16:53 UTC (rev 26601)
+++ trunk/freenet/src/freenet/crypt/Yarrow.java	2009-04-07 15:04:29 UTC (rev 26602)
@@ -488,18 +488,21 @@
 	private int accept_entropy(long data, EntropySource source, int actualEntropy) {
 
 		boolean performedPoolReseed = false;
-
+		byte[] b = new byte[] {
+				(byte) data,
+				(byte) (data >> 8),
+				(byte) (data >> 16),
+				(byte) (data >> 24),
+				(byte) (data >> 32),
+				(byte) (data >> 40),
+				(byte) (data >> 48),
+				(byte) (data >> 56)
+		};
+		
 		synchronized(this) {
 			fast_select = !fast_select;
 			MessageDigest pool = (fast_select ? fast_pool : slow_pool);
-			pool.update((byte) data);
-			pool.update((byte) (data >> 8));
-			pool.update((byte) (data >> 16));
-			pool.update((byte) (data >> 24));
-			pool.update((byte) (data >> 32));
-			pool.update((byte) (data >> 40));
-			pool.update((byte) (data >> 48));
-			pool.update((byte) (data >> 56));
+			pool.update(b);
 
 			if(fast_select) {
 				fast_entropy += actualEntropy;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.