Package net.i2p.crypto
Class SHA256Generator
java.lang.Object
net.i2p.crypto.SHA256Generator
public final class SHA256Generator extends Object
Defines a wrapper for SHA-256 operation.
As of release 0.8.7, uses java.security.MessageDigest by default.
As of release 0.9.25, uses only MessageDigest.
GNU-Crypto gnu.crypto.hash.Sha256Standalone
is removed as of 0.9.28.
-
Constructor Summary
Constructors Constructor Description SHA256Generator(I2PAppContext context)
-
Method Summary
Modifier and Type Method 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 MessageDigest
getDigestInstance()
Return a new MessageDigest from the system libs.static SHA256Generator
getInstance()
static void
main(String[] args)
-
Constructor Details
-
SHA256Generator
- Parameters:
context
- unused
-
-
Method Details
-
getInstance
-
calculateHash
Calculate the SHA-256 hash of the source and cache the result.- Parameters:
source
- what to hash- Returns:
- hash of the source
-
calculateHash
Calculate the hash and cache the result.- Parameters:
source
- what to hash
-
calculateHash
public final void calculateHash(byte[] source, int start, int len, byte[] out, int outOffset)Use this if you only need the data, not a Hash object. Does not cache.- Parameters:
out
- needs 32 bytes starting at outOffset
-
getDigestInstance
Return a new MessageDigest from the system libs.- Since:
- 0.8.7, public since 0.8.8 for FortunaStandalone
-
main
-