public class VirgilHash extends VirgilAsn1Compatible implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
VirgilHash.Algorithm
Enumerates possible Hash algorithms.
|
swigCMemOwn| Modifier | Constructor and Description |
|---|---|
|
VirgilHash()
Create a new instance of
VirgilHash |
protected |
VirgilHash(long cPtr,
boolean cMemoryOwn) |
|
VirgilHash(String name)
Create a new instance of
VirgilHash with given algorithm name. |
|
VirgilHash(VirgilHash.Algorithm alg)
Create a new instance of
VirgilHash with given algorithm. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
delete() |
protected void |
finalize() |
byte[] |
finish()
Return final data hash.
|
protected static long |
getCPtr(VirgilHash obj) |
byte[] |
hash(byte[] data)
Process the given data immediately and return it's hash.
|
byte[] |
hmac(byte[] key,
byte[] data)
Process the given message immediately and return it's HMAC hash.
|
byte[] |
hmacFinish()
Return final data HMAC hash.
|
void |
hmacReset()
Reset HMAC hashing for the new data hash.
|
void |
hmacStart(byte[] key)
Initialize HMAC hashing for the new data hash.
|
void |
hmacUpdate(byte[] data)
Update / process message HMAC hash.
|
String |
name()
Returns name of the hash function.
|
void |
start()
Initialize hashing for the new data hash.
|
int |
type()
Return underlying hash type.
|
void |
update(byte[] data)
Update / process message hash.
|
fromAsn1, getCPtr, toAsn1protected VirgilHash(long cPtr,
boolean cMemoryOwn)
public VirgilHash()
VirgilHashpublic VirgilHash(VirgilHash.Algorithm alg)
VirgilHash with given algorithm.alg - The algorithm.public VirgilHash(String name)
VirgilHash with given algorithm name.name - The algorithm name.protected static long getCPtr(VirgilHash obj)
protected void finalize()
finalize in class VirgilAsn1Compatiblepublic void delete()
delete in class VirgilAsn1Compatiblepublic void close()
close in interface AutoCloseableclose in class VirgilAsn1Compatiblepublic String name()
public int type()
public byte[] hash(byte[] data)
data - Date to be hashed.public void start()
public void update(byte[] data)
Update / process message hash.
This method MUST be used after start() method only. This method
MAY be called multiple times to process long message splitted to a
shorter chunks.
data - The data to be hashed.public byte[] finish()
update(byte[]) method.public byte[] hmac(byte[] key,
byte[] data)
key - Secret key.data - Data to be hashed.public void hmacStart(byte[] key)
key - Secret key.public void hmacReset()
public void hmacUpdate(byte[] data)
Update / process message HMAC hash.
This method MUST be used after hmacStart(byte[]) or
hmacReset() methods only. This method MAY be called multiple
times to process long message splitted to a shorter chunks.
data - Data to be hashed.public byte[] hmacFinish()
hmacUpdate(byte[])
method.Copyright © 2016. All rights reserved.