public abstract class MessageDigest extends Object
Abstract base class for text-oriented message digests.
Concrete algorithms are exposed as dedicated subclasses such as SHA256, SHA512, SHA3_256 or MD5. This keeps the public API explicit and easy to discover while preserving the shared buffering and file-digest helpers in one place. On Windows, MD5, SHA-1, SHA-256, SHA-384 and SHA-512 use the built-in CNG provider. Other algorithms use the optional OpenSSL provider. File digests stream bounded blocks and fail on read errors instead of returning partial results. On Unix, the system OpenSSL provider supplies all these algorithms.
import klyn.cryptography
md as MessageDigest = SHA256()
digest = md.digest("hello")
print(digest.size)
print(SHA512().digestInfo("hello").hex)| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | algorithmalgorithm as String |
Canonical digest algorithm name. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | digestdigest(text as String = null) as Byte[] throws CryptoException |
Hashes the buffered text and an optional final chunk. |
| public | digestFiledigestFile(path as Object) as Byte[] throws CryptoException |
Hashes a file from a String or Path value. |
| public | digestFileInfodigestFileInfo(path as Object) as Digest throws CryptoException |
Hashes a file and returns a structured digest view. |
| public | digestInfodigestInfo(text as String = null) as Digest throws CryptoException |
Hashes the buffered text and returns a structured digest view. |
| public static | getInstancegetInstance(algorithm as String) as MessageDigest throws CryptoException |
Compatibility factory for dynamic algorithm selection. |
| public | resetreset() as Void |
Resets the buffered text accumulated with update. |
| public override | toStringtoString() as String |
No summary. |
| public | updateupdate(text as String) as MessageDigest |
Appends text to the in-memory digest buffer. |