public class Random
extends java.lang.Object
Constructor and Description |
---|
Random()
Create a new initialized instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
calcServerAcceptKeyB64(java.lang.String webSocketKeyB64)
Precalculate the expected WebSocket accept key received from the server in the HTTP response (thread safe).
|
byte[] |
get16ByteRandom()
Get a 16 bytes random value (thread safe).
|
byte[] |
get20ByteRandom()
Get a 20 bytes random value (thread safe).
|
byte[] |
get4ByteRandom()
Get a 4 bytes random value (thread safe).
|
java.lang.String |
getNewWebSocketKeyB64()
Get a new WebSocket random key which can be send to the server in the HTTP request (thread safe).
|
byte[] |
getSHA1(byte[] b)
Get a SHA-1 hash (thread safe).
|
public Random()
public java.lang.String getNewWebSocketKeyB64()
public java.lang.String calcServerAcceptKeyB64(java.lang.String webSocketKeyB64)
webSocketKeyB64
- the WebSocket key which was sent to the server in Base 64 formatpublic byte[] getSHA1(byte[] b)
b
- the bytes from which the SHA-1 hash is calculated.public byte[] get20ByteRandom()
public byte[] get16ByteRandom()
public byte[] get4ByteRandom()