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. 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)
Properties
Modifier and Type Member Description
public readonly property algorithm
algorithm as String
Canonical digest algorithm name.
Inherited Properties
propertyInherited Properties 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.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml