Class Nonce
java.lang.Object
org.drasyl.handler.remote.protocol.Nonce
A
RemoteMessage is uniquely identified by its NONCE_LENGTH bytes long nonce.
This is an immutable object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final boolean -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static booleanisValidNonce(byte[] bytes) Checks ifbytesis a valid value.static Nonceof(byte[] bytes) static Noncestatic Nonceof(ImmutableByteArray bytes) static NonceStatic factory to retrieve a randomly generatedNonce.byte[]toString()voidwriteTo(io.netty.buffer.ByteBuf out) Writes this nonce to the bufferout.
-
Field Details
-
PSEUDORANDOM_NONCE
public static final boolean PSEUDORANDOM_NONCE -
NONCE_LENGTH
public static final int NONCE_LENGTH- See Also:
-
-
Method Details
-
toString
-
toByteArray
public byte[] toByteArray() -
toImmutableByteArray
-
equals
-
hashCode
public int hashCode() -
writeTo
public void writeTo(io.netty.buffer.ByteBuf out) Writes this nonce to the bufferout.- Parameters:
out- writes this nonce to the given buffer
-
randomNonce
Static factory to retrieve a randomly generatedNonce.- Returns:
- A randomly generated
Nonce
-
isValidNonce
public static boolean isValidNonce(byte[] bytes) Checks ifbytesis a valid value.- Parameters:
bytes- string to be validated- Returns:
trueif valid. Otherwisefalse
-
of
- Throws:
NullPointerException- ifbytesisnull
-
of
- Throws:
NullPointerException- ifbytesisnull
-
of
- Throws:
NullPointerException- ifbytesisnull
-