net.i2p.crypto
public final class SHA256Generator extends Object
Sha256Standalone
Constructor and Description |
---|
SHA256Generator(I2PAppContext context) |
Modifier and Type | Method and Description |
---|---|
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 SHA256Generator |
getInstance() |
static void |
main(String[] args)
Test the GNU and the JVM's implementations for speed
Results: 2011-05 eeepc Atom
|
public SHA256Generator(I2PAppContext context)
context
- unusedpublic static final SHA256Generator getInstance()
public final Hash calculateHash(byte[] source)
source
- what to hashpublic final Hash calculateHash(byte[] source, int start, int len)
public final void calculateHash(byte[] source, int start, int len, byte[] out, int outOffset)
out
- needs 32 bytes starting at outOffsetpublic static void main(String[] args)
JVM strlen GNU ms JVM ms Oracle 387 3861 3565 Oracle 40 825 635 Harmony 387 8082 5158 Harmony 40 4137 1753 JamVM 387 36301 34100 JamVM 40 7022 6016 gij 387 125833 4342 gij 40 22417 988