public class UtilsCrypto
extends java.lang.Object
Constructor and Description |
---|
UtilsCrypto() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
blake2AsU8a(byte[] data) |
static byte[] |
blake2AsU8a(byte[] data,
int bitLength) |
static byte[] |
blake2AsU8a(byte[] data,
int bitLength,
byte[] key)
Creates a blake2b u8a from the input.
|
static void |
main(java.lang.String[] args) |
static byte[] |
randomAsU8a() |
static byte[] |
randomAsU8a(int length)
Creates a Uint8Array filled with random bytes.
|
static java.math.BigInteger |
xxhash64AsBn(byte[] data,
long seed)
Creates a xxhash BN from the input.
|
static java.lang.String |
xxhash64AsRaw(byte[] data,
long seed)
Creates a xxhash non-prefixed hex from the input.
|
static long |
xxhash64AsValue(byte[] data,
long seed)
Creates a hex number from the input.
|
static byte[] |
xxhashAsU8a(byte[] data)
Creates a xxhash64 u8a from the input.
|
static byte[] |
xxhashAsU8a(byte[] data,
int bitLength) |
public static byte[] blake2AsU8a(byte[] data, int bitLength, byte[] key)
Creates a blake2b u8a from the input. From a Uint8Array
input, create the blake2b and return the result as a u8a with the specified bitLength
. example
blake2AsU8a("abc"); // => [0xba, 0x80, 0xa53, 0xf98, 0x1c, 0x4d, 0x0d]
public static byte[] blake2AsU8a(byte[] data)
public static byte[] blake2AsU8a(byte[] data, int bitLength)
public static byte[] xxhashAsU8a(byte[] data)
Creates a xxhash64 u8a from the input. From either a string
, Uint8Array
or a Buffer
input, create the xxhash64 and return the result as a Uint8Array
with the specified bitLength
. example
xxhashAsU8a("abc"); // => 0x44bc2cf5ad770999
public static byte[] xxhashAsU8a(byte[] data, int bitLength)
public static java.math.BigInteger xxhash64AsBn(byte[] data, long seed)
Creates a xxhash BN from the input. From either a string
, Uint8Array
or a Buffer
input, create the xxhash and return the result as a BN. example
xxhash64AsBn("abcd", 0xabcd)); // => new BN(0xe29f70f8b8c96df7)
public static java.lang.String xxhash64AsRaw(byte[] data, long seed)
Creates a xxhash non-prefixed hex from the input. From either a string
, Uint8Array
or a Buffer
input, create the xxhash and return the result as a non-prefixed hex string. example
xxhash64AsRaw("abcd", 0xabcd)); // => e29f70f8b8c96df7
public static long xxhash64AsValue(byte[] data, long seed)
Creates a hex number from the input. From either a string
, Uint8Array
or a Buffer
input, create the xxhash and return the result as a hex number example
xxhash64AsValue("abcd", 0xabcd)); // => e29f70f8b8c96df7
public static byte[] randomAsU8a(int length)
Creates a Uint8Array filled with random bytes. Returns a Uint8Array
with the specified (optional) length filled with random bytes. example
randomAsU8a(); // => Uint8Array([...])
public static byte[] randomAsU8a()
public static void main(java.lang.String[] args)