Author: toad
Date: 2005-12-09 21:58:28 +0000 (Fri, 09 Dec 2005)
New Revision: 7701
Modified:
trunk/freenet/src/freenet/keys/CHKBlock.java
trunk/freenet/src/freenet/keys/ClientCHKBlock.java
trunk/freenet/src/freenet/node/Version.java
Log:
299: (mandatory)
Bugfix 298's keylength change.
Modified: trunk/freenet/src/freenet/keys/CHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/CHKBlock.java 2005-12-09 21:45:59 UTC
(rev 7700)
+++ trunk/freenet/src/freenet/keys/CHKBlock.java 2005-12-09 21:58:28 UTC
(rev 7701)
@@ -34,7 +34,7 @@
final short hashIdentifier;
final NodeCHK chk;
public static final int MAX_LENGTH_BEFORE_COMPRESSION = Integer.MAX_VALUE;
- final static int HASH_SHA1 = 1;
+ final static int HASH_SHA256 = 1;
public String toString() {
return super.toString()+": chk="+chk;
@@ -69,11 +69,11 @@
// Minimal verification
// Check the hash
- if(hashIdentifier != HASH_SHA1)
- throw new CHKVerifyException("Hash not SHA-1");
+ if(hashIdentifier != HASH_SHA256)
+ throw new CHKVerifyException("Hash not SHA-256");
MessageDigest md;
try {
- md = MessageDigest.getInstance("SHA-1");
+ md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new Error(e);
}
Modified: trunk/freenet/src/freenet/keys/ClientCHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHKBlock.java 2005-12-09 21:45:59 UTC
(rev 7700)
+++ trunk/freenet/src/freenet/keys/ClientCHKBlock.java 2005-12-09 21:58:28 UTC
(rev 7701)
@@ -163,8 +163,8 @@
// IV = E(H(crypto key))
byte[] plainIV = md256.digest(encKey);
header = new byte[plainIV.length+2+2];
- header[0] = (byte)(CHKBlock.HASH_SHA1 >> 8);
- header[1] = (byte)(CHKBlock.HASH_SHA1 & 0xff);
+ header[0] = (byte)(CHKBlock.HASH_SHA256 >> 8);
+ header[1] = (byte)(CHKBlock.HASH_SHA256 & 0xff);
System.arraycopy(plainIV, 0, header, 2, plainIV.length);
header[plainIV.length+2] = (byte)(finalData.length >> 8);
header[plainIV.length+3] = (byte)(finalData.length & 0xff);
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-12-09 21:45:59 UTC (rev
7700)
+++ trunk/freenet/src/freenet/node/Version.java 2005-12-09 21:58:28 UTC (rev
7701)
@@ -20,10 +20,10 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- public static final int buildNumber = 298;
+ public static final int buildNumber = 299;
/** Oldest build of Fred we will talk to */
- public static final int lastGoodBuild = 298;
+ public static final int lastGoodBuild = 299;
/** The highest reported build of fred */
public static int highestSeenBuild = buildNumber;