Skip to content

Construct a de-salting SaltShaker

This operation builds a SaltShaker instance using the parameterless constructor, which leaves _dateParts as null and is only safe to use for BlandHash (OP-HU-04), never SaltHash. In-repo, SystemHashService.RemoveSystemHashSaltAndValidateLifetime is the sole caller.

Field Value
Operation ID OP-HU-02
Trigger Caller needs to de-salt a hash (in-repo: SystemHashService.RemoveSystemHashSaltAndValidateLifetime)
Inputs none
Outputs SaltShaker instance with _random populated; _dateParts left null
Primary components SaltShaker.SaltShaker()
Entry point src/SAIF.NetCore.HashUtil/SAIF.NetCore.HashUtil/SaltShaker.cs

Steps

  1. Create a new System.Random instance (BR-HU-04 — this instance is unusable for SaltHash because _dateParts is never populated).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller needs to de-salt a hash]) --> S1["Create System.Random;<br>_dateParts left null"]
    S1 --> EndOk([Instance ready for BlandHash only])

Failure and edge-case behavior

  • The resulting instance has a null _dateParts; calling SaltHash on it throws an unguarded NullReferenceException because SaltHash iterates _dateParts directly (BR-HU-04).

Sources

  • src/SAIF.NetCore.HashUtil/SAIF.NetCore.HashUtil/SaltShaker.cs
  • src/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SystemHashService.cs