public class Util
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static int |
BUFFER_SIZE |
static java.util.Map<java.lang.String,java.security.Provider> |
mdProviders |
static java.math.BigInteger |
TWO |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static boolean |
byteArrayEqual(byte[] a,
byte[] b,
int offset,
int length)
Deprecated.
|
static void |
fillByteArrayFromInts(int[] ints,
byte[] bytes) |
static void |
fillByteArrayFromLongs(long[] ints,
byte[] bytes) |
static BlockCipher |
getCipherByName(java.lang.String name) |
static BlockCipher |
getCipherByName(java.lang.String name,
int keySize) |
static byte[] |
hashBytes(java.security.MessageDigest d,
byte[] b) |
static byte[] |
hashBytes(java.security.MessageDigest d,
byte[] b,
int offset,
int length) |
static byte[] |
hashString(java.security.MessageDigest d,
java.lang.String s)
Hashes a string in a consistent manner
|
static double |
keyDigestAsNormalizedDouble(byte[] digest) |
static int |
log2(long n) |
static void |
main(java.lang.String[] args) |
static void |
makeKey(byte[] entropy,
byte[] key,
int offset,
int len) |
static byte[] |
MPIbytes(java.math.BigInteger num) |
static void |
randomBytes(java.util.Random r,
byte[] buf)
Fill byte array with random data.
|
static void |
randomBytes(java.util.Random r,
byte[] buf,
int from,
int len)
Fill specified range of byte array with random data.
|
static void |
randomBytes(java.security.SecureRandom r,
byte[] buf) |
static void |
randomBytes(java.security.SecureRandom r,
byte[] buf,
int from,
int len) |
static void |
readFully(java.io.InputStream in,
byte[] b) |
static void |
readFully(java.io.InputStream in,
byte[] b,
int off,
int length) |
static java.math.BigInteger |
readMPI(java.io.InputStream in) |
static void |
writeMPI(java.math.BigInteger num,
java.io.OutputStream out) |
static byte[] |
xor(byte[] b1,
byte[] b2) |
protected static final int BUFFER_SIZE
public static final java.math.BigInteger TWO
public static final java.util.Map<java.lang.String,java.security.Provider> mdProviders
public static void fillByteArrayFromInts(int[] ints, byte[] bytes)
public static void fillByteArrayFromLongs(long[] ints, byte[] bytes)
public static byte[] MPIbytes(java.math.BigInteger num)
public static void writeMPI(java.math.BigInteger num, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static java.math.BigInteger readMPI(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static byte[] hashBytes(java.security.MessageDigest d, byte[] b)
public static byte[] hashBytes(java.security.MessageDigest d, byte[] b, int offset, int length)
public static byte[] hashString(java.security.MessageDigest d, java.lang.String s)
public static byte[] xor(byte[] b1, byte[] b2)
public static void randomBytes(java.security.SecureRandom r, byte[] buf)
public static void randomBytes(java.security.SecureRandom r, byte[] buf, int from, int len)
public static void randomBytes(java.util.Random r, byte[] buf)
public static void randomBytes(java.util.Random r, byte[] buf, int from, int len)
@Deprecated public static boolean byteArrayEqual(byte[] a, byte[] b, int offset, int length)
public static void makeKey(byte[] entropy, byte[] key, int offset, int len)
public static BlockCipher getCipherByName(java.lang.String name)
public static BlockCipher getCipherByName(java.lang.String name, int keySize)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public static int log2(long n)
public static void readFully(java.io.InputStream in, byte[] b) throws java.io.IOException
java.io.IOException
public static void readFully(java.io.InputStream in, byte[] b, int off, int length) throws java.io.IOException
java.io.IOException
public static double keyDigestAsNormalizedDouble(byte[] digest)