[freenet-cvs] r17734 - trunk/freenet/src/freenet/support

nextgens at freenetproject.org nextgens at freenetproject.org
Sat Feb 9 01:20:42 UTC 2008


Author: nextgens
Date: 2008-02-09 01:20:42 +0000 (Sat, 09 Feb 2008)
New Revision: 17734

Removed:
   trunk/freenet/src/freenet/support/CRC.java
Log:
freenet.support.CRC: delete it : java.util.zip.CRC32 does the same

Deleted: trunk/freenet/src/freenet/support/CRC.java
===================================================================
--- trunk/freenet/src/freenet/support/CRC.java	2008-02-09 01:14:18 UTC (rev 17733)
+++ trunk/freenet/src/freenet/support/CRC.java	2008-02-09 01:20:42 UTC (rev 17734)
@@ -1,44 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.support;
-
-/**
- * A class to compute CRCs complying with ISO 3309
- * It's used in the PNG filter.
- * 
- * @author nextgens
- */
-public class CRC {
-	public static final long[] CRC_TABLE = new long[256];
-	public static final long PNG_POLYNOMINAL = 0xedb88320L;
-	
-	static {
-		long c;
-		for(int i=0; i<256; i++) {
-			c = i;
-			for(int j=0; j<8; j++) {
-				if(0 != (c & 1))
-					c = PNG_POLYNOMINAL^(c >> 1);
-				else
-					c = c >> 1;
-			}
-			CRC_TABLE[i] = c;
-		}
-	}
-	
-	private static long update_crc(long crc, byte[] buf) {
-		// it can't be above 2^31-1 anyway... hence we use an int
-		if(buf.length > Integer.MAX_VALUE)
-			throw new IllegalArgumentException("The buffer is too big!");
-		
-		for (int i = 0; i < buf.length; i++)
-			crc = CRC_TABLE[(int)(crc ^ buf[i]) & 0xff] ^ (crc >> 8);
-		
-		return crc;
-	}
-	
-	public static long crc(byte[] input) {
-		return update_crc(0xffffffffL, input) ^ 0xffffffffL;
-	}
-}




More information about the cvs mailing list