MessageDigest
classin packageklyn.cryptography
public abstract class MessageDigest extends Object:
└ MessageDigest
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.
import klyn.cryptography

md as MessageDigest = SHA256()
digest = md.digest("hello")
print(digest.size)
print(SHA512().digestInfo("hello").hex)
Properties
Modifier and Type Member Description
public readonly property algorithm
algorithm as String
Canonical digest algorithm name.
Properties inherited from Object: type
Methods
Modifier and Type Member Description
public digest
digest(text as String = null) as Byte[] throws CryptoException:
Hashes the buffered text and an optional final chunk.
public digestFile
digestFile(path as Object) as Byte[] throws CryptoException:
Hashes a file from a `String` or `Path` value.
public digestFileInfo
digestFileInfo(path as Object) as Digest throws CryptoException:
Hashes a file and returns a structured digest view.
public digestInfo
digestInfo(text as String = null) as Digest throws CryptoException:
Hashes the buffered text and returns a structured digest view.
public static getInstance
getInstance(algorithm as String) as MessageDigest throws CryptoException:
Compatibility factory for dynamic algorithm selection.
public reset
reset() as Void:
Resets the buffered text accumulated with `update`.
public override toString
toString() as String:
No summary.
public update
update(text as String) as MessageDigest:
Appends text to the in-memory digest buffer.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml