Skip to main content

Hash

Hash is used for creating and manipulating hash values using various hashing algorithms.

Summary​

public final class Hash
Provides methods for hashing data, setting hash values, and managing hash state.
Methods
type
type (setter)
hash
add
clear
setHash

Methods​

type()​

Retrieves the current hash algorithm type.

public native Enums.HashType type()
Return Value
Enums.HashType — The current hash algorithm type.

type(Enums.HashType type)​

Sets the hash algorithm type.

public native void type(Enums.HashType type)
Parameters
type: Enums.HashType — The hash algorithm type to set.
Return Value
none

hash()​

Retrieves the generated hash value.

public native byte[] hash()
Return Value
byte[] — The generated hash value as a byte array.

add(Object data)​

Adds data to the current hash calculation.

public native void add(Object data)
Parameters
data: Object — The data to include in the hash calculation.
Return Value
none

clear()​

Clears the current hash state.

public native void clear()
Return Value
none

setHash(Enums.HashType hashType, byte[] data)​

Manually sets the hash value.

public native void setHash(Enums.HashType hashType, byte[] data)
Parameters
hashType: Enums.HashType — The hash algorithm type.
data: byte[] — The hash data to set.
Return Value
none