SAIF.NetCore.HashUtil operations and processes¶
This page is the operation catalog and cross-operation hub for this library. Each operation's detailed, step-by-step logic lives in its own page under operations/.
Operation catalog¶
| Operation | Intent | Trigger | Inputs | Outputs | Rules |
|---|---|---|---|---|---|
| Construct a salting SaltShaker | Build a SaltShaker instance that can salt a hash |
Caller needs to salt a hash | createDate (DateTime) |
Instance with populated _dateParts |
BR-HU-02, BR-HU-03 |
| Construct a de-salting SaltShaker | Build a SaltShaker instance that can de-salt a hash |
Caller needs to de-salt a hash | none | Instance with _dateParts left null |
BR-HU-04 |
| Salt a system hash | Embed a create date into a hash string at random positions | Called after constructing a salting SaltShaker |
systemHash (string) |
Salted hash string: a location map that is 42 characters wide only when every post-insertion body-length field renders as exactly two digits (each insertion keeps the body between 10 and 99 characters), followed by the salted body, whose total length varies with systemHash.Length; inputs outside that range may still produce a returned string, but without a guaranteed-width location map or a supported round trip |
BR-HU-01, BR-HU-04, BR-HU-05, BR-HU-06, BR-HU-07 |
| De-salt a system hash and recover the embedded date | Remove the location map, recover the embedded create date, and return the original hash | Called after constructing a de-salting SaltShaker |
saltyHash produced by salting |
Original hash (return value); embedded create date (out expireDate) |
BR-HU-01, BR-HU-02, BR-HU-03, BR-HU-06, BR-HU-07, BR-HU-08 |
| Signal an expired system hash | Construct the exception a consumer throws once it decides a recovered date has expired | Consumer decides a hash has expired | nowDate, hashDate |
SystemHashExpiredException with a fixed-format message |
BR-HU-09 |
Process flow diagram¶
The following diagram visualizes the primary salt/de-salt round trip across operations.
flowchart TD
Start([Caller needs a salted hash]) --> OP1["OP-HU-01: Construct salting SaltShaker"]
OP1 --> OP3["OP-HU-03: Salt a system hash"]
OP3 --> Stored([Salted hash returned to caller])
Stored --> OP2["OP-HU-02: Construct de-salting SaltShaker"]
OP2 --> OP4["OP-HU-04: De-salt a system hash"]
OP4 --> Decision{Consumer evaluates<br>recovered create date}
Decision -->|Still valid| EndOk([Original hash returned to caller])
Decision -->|Expired| OP5["OP-HU-05: Signal expired system hash"]
OP5 --> EndErr([SystemHashExpiredException thrown by consumer])
Failure and edge-case behavior¶
- A
SaltShakerbuilt with the parameterless constructor (OP-HU-02) has anull_dateParts; callingSaltHashon it throws an unguardedNullReferenceException(BR-HU-04). BlandHashperforms no lifetime check of its own and never throwsSystemHashExpiredException— the expiry decision and throw belong entirely to the calling consumer (OP-HU-05).- A
saltyHashshorter than 42 characters, a malformed map, an out-of-range insertion index, or an unparseable date string under the current culture each surface as an unguarded BCL exception (ArgumentOutOfRangeExceptionorFormatException) rather than a library-specific error.
Related documentation¶
Sources¶
src/SAIF.NetCore.HashUtil/SAIF.NetCore.HashUtil/SaltShaker.cssrc/SAIF.NetCore.HashUtil/SAIF.NetCore.HashUtil/SystemHashExpiredException.cssrc/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SystemHashService.cs