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
Modifier and TypeFieldDescriptionstatic final int
static final boolean
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
static boolean
isValidNonce
(ImmutableByteArray bytes) Checks ifbytes
is a valid value.static Nonce
of
(byte[] bytes) static Nonce
static Nonce
of
(ImmutableByteArray bytes) static Nonce
Static factory to retrieve a randomly generatedNonce
.byte[]
toString()
-
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() -
randomNonce
Static factory to retrieve a randomly generatedNonce
.- Returns:
- A randomly generated
Nonce
-
isValidNonce
Checks ifbytes
is a valid value.- Parameters:
bytes
- string to be validated- Returns:
true
if valid. Otherwisefalse
-
of
- Throws:
NullPointerException
- ifbytes
isnull
-
of
- Throws:
NullPointerException
- ifbytes
isnull
-
of
- Throws:
NullPointerException
- ifbytes
isnull
-