hash_base64_decode()
def hash_base64_decode(base64_string) -> stringDecode base64-encoded bytes.
Converts a base64 string back into raw bytes (as a UTF-8 string). Inverse of hash_base64_encode().
Raises: Error: If the base64 string is invalid or decoded bytes are not valid UTF-8
Args
base64_string: string: The base64 string to decode
Returns
str: The decoded bytes as a UTF-8 string
hash_base64_encode()
def hash_base64_encode(data) -> stringEncode raw bytes as base64.
Converts the byte representation of a string into base64 encoding. Base64 is commonly used for transmitting binary data over text-based protocols like email and HTTP.
Raises: Error: If encoding fails
Args
data: string: The string to base64-encode
Returns
str: The base64-encoded representation
hash_blake3()
def hash_blake3(data) -> stringCompute the BLAKE3 hash of a string.
BLAKE3 is a modern cryptographic hash function that is significantly faster than SHA-256/SHA-512 while providing equivalent security guarantees. It produces a 256-bit (64 hexadecimal character) digest by default.
Raises: Error: If hashing fails
Args
data: string: The string to hash
Returns
str: The BLAKE3 hash as a hexadecimal-encoded string (64 characters)
hash_blake3_file()
def hash_blake3_file(file_path) -> stringCompute the BLAKE3 hash of a file.
Reads the file in 64 KiB streaming chunks so large files never cause excessive memory consumption. Returns a 256-bit (64 hexadecimal character) digest.
Raises: Error: If the file cannot be read or hashing fails
Args
file_path: string: Path to the file to hash (relative to workspace root)
Returns
str: The BLAKE3 hash as a hexadecimal-encoded string (64 characters)
hash_compute_sha256_from_file()
def hash_compute_sha256_from_file(file_path) -> stringCompute SHA256 hash of a file. Backward compatibility alias.
This function is provided for backward compatibility. Prefer hash_sha256_file() for new code.
Args
file_path: string: The path to the file to hash
Returns
str: Hexadecimal-encoded SHA256 digest (64 characters)
hash_compute_sha256_from_string()
def hash_compute_sha256_from_string(value) -> stringCompute SHA256 hash of a string. Backward compatibility alias.
This function is provided for backward compatibility. Prefer hash_sha256() for new code.
Args
value: string: The string content to hash
Returns
str: Hexadecimal-encoded SHA256 digest (64 characters)
hash_crc32()
def hash_crc32(data) -> stringCompute the CRC32 checksum of a string.
CRC32 produces a 32-bit (8 hexadecimal character) checksum. It is a simple error-detection mechanism, NOT cryptographically secure. Use it only for detecting accidental data corruption, not malicious tampering.
Raises: Error: If checksumming fails
Args
data: string: The string to checksum
Returns
str: The CRC32 checksum as a zero-padded hexadecimal string (8 characters)
hash_crc32_file()
def hash_crc32_file(file_path) -> stringCompute the CRC32 checksum of a file.
Reads the entire file and computes its CRC32 checksum. Useful for detecting accidental corruption but not for security-critical integrity checks.
Raises: Error: If the file cannot be read or checksumming fails
Args
file_path: string: Path to the file to checksum (relative to workspace root)
Returns
str: The CRC32 checksum as a zero-padded hexadecimal string (8 characters)
hash_hex_decode()
def hash_hex_decode(hex_string) -> stringDecode hexadecimal-encoded bytes.
Converts a hexadecimal string back into raw bytes (as a UTF-8 string). Inverse of hash_hex_encode().
Raises: Error: If the hex string is invalid or decoded bytes are not valid UTF-8
Args
hex_string: string: The hexadecimal string to decode
Returns
str: The decoded bytes as a UTF-8 string
hash_hex_encode()
def hash_hex_encode(data) -> stringEncode raw bytes as hexadecimal.
Converts the byte representation of a string into a hexadecimal-encoded format. Useful for displaying binary data in human-readable form.
Raises: Error: If encoding fails
Args
data: string: The string to hex-encode
Returns
str: The hexadecimal-encoded representation
hash_md5()
def hash_md5(data) -> stringCompute the MD5 hash of a string.
MD5 produces a 128-bit (32 hexadecimal character) digest. MD5 is cryptographically broken and should NOT be used for security purposes. It is provided for legacy compatibility and non-critical checksums only.
Raises: Error: If hashing fails
Args
data: string: The string to hash
Returns
str: The MD5 hash as a hexadecimal-encoded string (32 characters)
hash_md5_file()
def hash_md5_file(file_path) -> stringCompute the MD5 hash of a file.
Reads the entire file and computes its MD5 digest. MD5 is provided for legacy compatibility but should not be used for security-critical applications.
Raises: Error: If the file cannot be read or hashing fails
Args
file_path: string: Path to the file to hash (relative to workspace root)
Returns
str: The MD5 hash as a hexadecimal-encoded string (32 characters)
hash_sha1()
def hash_sha1(data) -> stringCompute the SHA1 hash of a string.
SHA1 produces a 160-bit (40 hexadecimal character) digest. While still widely used, SHA1 is considered cryptographically weak. Prefer SHA256 for new applications requiring security guarantees.
Raises: Error: If hashing fails
Args
data: string: The string to hash
Returns
str: The SHA1 hash as a hexadecimal-encoded string (40 characters)
hash_sha1_file()
def hash_sha1_file(file_path) -> stringCompute the SHA1 hash of a file.
Reads the entire file and computes its SHA1 digest. Commonly used for Git-like identifiers and legacy systems.
Raises: Error: If the file cannot be read or hashing fails
Args
file_path: string: Path to the file to hash (relative to workspace root)
Returns
str: The SHA1 hash as a hexadecimal-encoded string (40 characters)
hash_sha256()
def hash_sha256(data) -> stringCompute the SHA256 hash of a string.
SHA256 is a secure cryptographic hash function that produces a 256-bit (64 hexadecimal character) digest. It is commonly used for checksums, digital signatures, and integrity verification.
Raises: Error: If hashing fails
Args
data: string: The string to hash
Returns
str: The SHA256 hash as a hexadecimal-encoded string (64 characters)
hash_sha256_file()
def hash_sha256_file(file_path) -> stringCompute the SHA256 hash of a file.
Reads the entire file and computes its SHA256 digest. Useful for verifying file integrity, detecting changes, or creating checksums.
Raises: Error: If the file cannot be read or hashing fails
Args
file_path: string: Path to the file to hash (relative to workspace root)
Returns
str: The SHA256 hash as a hexadecimal-encoded string (64 characters)
hash_sha512()
def hash_sha512(data) -> stringCompute the SHA512 hash of a string.
SHA512 produces a 512-bit (128 hexadecimal character) digest. It provides stronger security guarantees than SHA256 but is slower and produces larger hashes. Use when maximum security is required.
Raises: Error: If hashing fails
Args
data: string: The string to hash
Returns
str: The SHA512 hash as a hexadecimal-encoded string (128 characters)
hash_sha512_file()
def hash_sha512_file(file_path) -> stringCompute the SHA512 hash of a file.
Reads the entire file and computes its SHA512 digest. Provides the strongest standard hash-based integrity verification among common algorithms.
Raises: Error: If the file cannot be read or hashing fails
Args
file_path: string: Path to the file to hash (relative to workspace root)
Returns
str: The SHA512 hash as a hexadecimal-encoded string (128 characters)