Class CryptographicHash
- Namespace
- EncDotNet.S100.ExchangeSets
- Assembly
- EncDotNet.S100.ExchangeSets.dll
Represents a parsed S-100 cryptographic hash MRN of the form
urn:mrn:iho:s100:hash:<algorithm>:<hex>, used to declare
the expected digest of an exchange-set resource so its content integrity
can be verified independently of any digital signature.
public sealed class CryptographicHash
- Inheritance
-
CryptographicHash
- Inherited Members
Remarks
S-100 Edition 5.2.1 Part 15 §15-8.10, Table 15-12. The MRN namespace is defined by the specification, but a fixed catalogue slot for it is not; ExchangeCatalogueReader therefore discovers it best-effort. All fields are case-insensitive per the specification.
Constructors
CryptographicHash(string, string)
Initializes a new instance of the CryptographicHash class.
public CryptographicHash(string algorithm, string hexValue)
Parameters
algorithmstringThe hash algorithm token (e.g.
sha256), normalized to lower case.hexValuestringThe computed hash expressed as a lower-case hexadecimal string.
Fields
MrnPrefix
The MRN prefix shared by every S-100 cryptographic hash MRN.
public const string MrnPrefix = "urn:mrn:iho:s100:hash:"
Field Value
Properties
Algorithm
The hash algorithm token (e.g. sha256), in lower case.
public string Algorithm { get; }
Property Value
HexValue
The expected hash expressed as a lower-case hexadecimal string.
public string HexValue { get; }
Property Value
Methods
Matches(string?)
Returns true when candidate matches
this declared hash, comparing the hexadecimal value case-insensitively.
public bool Matches(string? candidate)
Parameters
candidatestringA computed hash expressed as a hexadecimal string.
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryParse(string?, out CryptographicHash?)
Attempts to parse an S-100 cryptographic hash MRN
(urn:mrn:iho:s100:hash:<algorithm>:<hex>).
public static bool TryParse(string? value, out CryptographicHash? hash)
Parameters
valuestringThe candidate MRN string (may be null).
hashCryptographicHashThe parsed hash on success; otherwise null.
Returns
Remarks
S-100 Edition 5.2.1 Part 15 §15-8.10, Table 15-12.