java.lang.Object
net.i2p.router.crypto.ratchet.RatchetSessionTag
8-byte session tag for ratchet protocol messages with efficient long-based storage representation for memory optimization Does not extend SessionTag or DataStructure to save space.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionRatchetSessionTag(byte[] val) First 8 bytes of the given value are copied; the reference is not kept.RatchetSessionTag(long val) Tag from a long value for compact 8-byte storage.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanCompares by long value for fast identity.byte[]getData()The tag as a byte array.longgetLong()The tag as a long value.inthashCode()We assume the data has enough randomness in it, so use 4 bytes for speed.intlength()Return the fixed length of the tag.toBase64()12 chars.toString()Describe the tag for log messages.
Field Details
LENGTH
_data
private final long _dataThe 64-bit session tag value.
Constructor Details
RatchetSessionTag
public RatchetSessionTag(long val) Tag from a long value for compact 8-byte storage.- Parameters:
val- the 64-bit tag value, stored as-is
RatchetSessionTag
public RatchetSessionTag(byte[] val) First 8 bytes of the given value are copied; the reference is not kept.- Parameters:
val- will copy the first 8 bytes. Reference will not be kept.
Method Details
getData
public byte[] getData()The tag as a byte array.- Returns:
- data as a byte array
getLong
public long getLong()The tag as a long value.- Returns:
- data as a long value
length
toBase64
12 chars.- Returns:
- the tag encoded with the I2P base64 alphabet, 12 characters ending in '='
hashCode
equals
toString