Class FileHashHandler
java.lang.Object
lib.pwss.hash.file_hash_handler.FileHashHandler
- All Implemented Interfaces:
FileHash
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringPrefix for BLAKE2b hash output.protected final intDigest size for BLAKE2b algorithm in bytes.protected final StringError string constant.protected final StringPrefix for SHA-256 hash output.protected final StringPrefix for SHA3 hash output. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final StringbytesToHex(byte[] bytes) Convert a byte sequence to its hexadecimal string representation.final StringcalculateBlake2bHash(File file) Calculates the Blake2B Hash of a filefinal StringcalculateSha256Hash(File file) Calculates the SHA256 Hash of a filefinal StringcalculateSha3Hash(File file) Calculates the SHA3 Hash of a filefinal HashForFilesOutputGetAllHashes(File file) Calculates hashes of three different algorithms (SHA2,SHA3, BLAKE_2B) of a fileMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FileHash
GetAllHashes
-
Field Details
-
DIGEST_SIZE_BLAKE_2B
protected final int DIGEST_SIZE_BLAKE_2BDigest size for BLAKE2b algorithm in bytes.- See Also:
-
ERROR
-
SHA256_PRINT_PREFIX
-
SHA3_PRINT_PREFIX
-
BLAKE_2B_PRINT_PREFIX
-
-
Constructor Details
-
FileHashHandler
public FileHashHandler()Public Constructor
-
-
Method Details
-
calculateSha256Hash
Calculates the SHA256 Hash of a file- Specified by:
calculateSha256Hashin interfaceFileHash- Parameters:
file- to extract hash from- Returns:
- A string containing the hexadecimal representation of the bytes in SHA2 Hash
-
calculateSha3Hash
Calculates the SHA3 Hash of a file- Specified by:
calculateSha3Hashin interfaceFileHash- Parameters:
file- to extract hash from- Returns:
- A string containing the hexadecimal representation of the bytes in SHA3 Hash
-
calculateBlake2bHash
Calculates the Blake2B Hash of a file- Specified by:
calculateBlake2bHashin interfaceFileHash- Parameters:
file- to extract hash from- Returns:
- A string containing the hexadecimal representation of the bytes in a Blake2B Hash
-
bytesToHex
Convert a byte sequence to its hexadecimal string representation. This function takes a bytes object and returns a string containing two hexadecimal digits for each byte in the input, using lowercase letters.- Parameters:
bytes- (bytes): The byte sequence to be converted to hexadecimal.- Returns:
- str: A string containing the hexadecimal representation of the bytes.
-
GetAllHashes
Calculates hashes of three different algorithms (SHA2,SHA3, BLAKE_2B) of a file- Parameters:
file- The file to extract hash from- Returns:
- A wrapper object containing the file and the three resulting hash strings
-