public final class SHA256Generator extends Object
| Constructor and Description |
|---|
SHA256Generator(I2PAppContext context)Unused. |
| Modifier and Type | Method and Description |
|---|---|
MessageDigest | acquire()Get a MessageDigest instance from the pool,
for uses where the one-shot calculateHash()
would require copying the data. |
Hash | calculateHash(byte[] source)Calculate the SHA-256 hash of the source and cache the result. |
Hash | calculateHash(byte[] source,
int start,
int len)Calculate the hash and cache the result. |
void | calculateHash(byte[] source,
int start,
int len,
byte[] out,
int outOffset)Use this if you only need the data, not a Hash object. |
static MessageDigest | getDigestInstance()Return a new MessageDigest from the system libs. |
static SHA256Generator | getInstance()Instance. |
static void | main(String[] args)main. |
void | release(MessageDigest digest)Release a digest back to the pool |
public SHA256Generator(I2PAppContext context)
context - unusedpublic MessageDigest acquire()
public final Hash calculateHash(byte[] source)
source - what to hashpublic final Hash calculateHash(byte[] source, int start, int len)
source - what to hashstart - the starting offsetlen - the length to hashpublic final void calculateHash(byte[] source,
int start,
int len,
byte[] out,
int outOffset)out - needs 32 bytes starting at outOffsetpublic static MessageDigest getDigestInstance()
public static final SHA256Generator getInstance()
public static void main(String[] args)
public void release(MessageDigest digest)
digest - must be SHA-256