From 9e250bc07db45fa1f9a421a613eea25a5964d907 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 26 Nov 2010 00:32:44 +0000 Subject: [PATCH] fix hashcode and javadocs --- core/java/src/net/i2p/data/Payload.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/data/Payload.java b/core/java/src/net/i2p/data/Payload.java index 89cac8ff5d..0371ed73f0 100644 --- a/core/java/src/net/i2p/data/Payload.java +++ b/core/java/src/net/i2p/data/Payload.java @@ -19,6 +19,10 @@ import net.i2p.util.Log; * Defines the actual payload of a message being delivered, including the * standard encryption wrapping, as defined by the I2P data structure spec. * + * This is used mostly in I2CP, where we used to do end-to-end encryption. + * Since we don't any more, you probably just want to use the + * get/set EncryptedData methods. + * * @author jrandom */ public class Payload extends DataStructureImpl { @@ -32,6 +36,9 @@ public class Payload extends DataStructureImpl { /** * Retrieve the unencrypted body of the message. * + * Deprecated. + * Unless you are doing encryption, use getEncryptedData() instead. + * * @return body of the message, or null if the message has either not been * decrypted yet or if the hash is not correct */ @@ -43,15 +50,19 @@ public class Payload extends DataStructureImpl { * Populate the message body with data. This does not automatically encrypt * yet. * + * Deprecated. + * Unless you are doing encryption, use setEncryptedData() instead. */ public void setUnencryptedData(byte[] data) { _unencryptedData = data; } + /** the real data */ public byte[] getEncryptedData() { return _encryptedData; } + /** the real data */ public void setEncryptedData(byte[] data) { _encryptedData = data; } @@ -100,7 +111,7 @@ public class Payload extends DataStructureImpl { @Override public int hashCode() { - return DataHelper.hashCode(_unencryptedData); + return DataHelper.hashCode(_encryptedData != null ? _encryptedData : _unencryptedData); } @Override -- GitLab