final class WebSocketUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static FastThreadLocal<java.security.MessageDigest> |
MD5 |
private static FastThreadLocal<java.security.MessageDigest> |
SHA1 |
Modifier | Constructor and Description |
---|---|
private |
WebSocketUtil()
A private constructor to ensure that instances of this class cannot be made
|
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
base64(byte[] data)
Performs base64 encoding on the specified data
|
private static byte[] |
digest(FastThreadLocal<java.security.MessageDigest> digestFastThreadLocal,
byte[] data) |
(package private) static byte[] |
md5(byte[] data)
Performs a MD5 hash on the specified data
|
(package private) static byte[] |
randomBytes(int size)
Creates an arbitrary number of random bytes
|
(package private) static int |
randomNumber(int minimum,
int maximum)
Generates a pseudo-random number
|
(package private) static byte[] |
sha1(byte[] data)
Performs a SHA-1 hash on the specified data
|
private static final FastThreadLocal<java.security.MessageDigest> MD5
private static final FastThreadLocal<java.security.MessageDigest> SHA1
private WebSocketUtil()
static byte[] md5(byte[] data)
data
- The data to hashstatic byte[] sha1(byte[] data)
data
- The data to hashprivate static byte[] digest(FastThreadLocal<java.security.MessageDigest> digestFastThreadLocal, byte[] data)
static java.lang.String base64(byte[] data)
data
- The data to encodestatic byte[] randomBytes(int size)
size
- the number of random bytes to createstatic int randomNumber(int minimum, int maximum)
minimum
- The minimum allowable valuemaximum
- The maximum allowable value