Skip to content

Compute the identity hash

The shared, private digest routine used by both the salted and unsalted issuing operations: builds the "{systemName}-{(int)type}" identity string and hashes it.

Field Value
Operation ID OP-SH-05
Trigger Internal delegation from Compute a salted system hash or Compute an unsalted system hash on demand.
Inputs type (SystemType), systemName (string)
Outputs 44-character Base64 SHA-256 string
Primary components SystemHashService.GetHashValue (private)
Entry point src/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SAIF.NetCore.SystemHash/SystemHashService.cs

Steps

  1. Build the identity string "{systemName}-{(int)type}", using the SystemType enum's integer ordinal, not its name (BR-SH-02).
  2. Encode the identity string as UTF-16LE bytes (Encoding.Unicode.GetBytes) (BR-SH-01).
  3. Compute the SHA-256 digest of those bytes.
  4. Base64-encode the digest and return it (44 characters) (BR-SH-01).

Process flow

The following diagram shows the shared identity-hash computation used internally by both the salted-issuance and unsalted-comparison operations; it performs no salting, lifetime checking, or external identity comparison itself.

flowchart TD
    Start(["type, systemName"]) --> BuildId["Build identity string: systemName-ordinal"]
    BuildId --> Encode[Encode as UTF-16LE bytes]
    Encode --> Sha[Compute SHA-256 digest]
    Sha --> Base64[Base64-encode digest]
    Base64 --> Return([Return 44-char hash])

Failure and edge-case behavior

  • Reordering or inserting members in the SystemType enum (SAIF.NetCore.ServiceContracts) silently changes the identity hash for every system type whose ordinal shifted, with no compile-time or run-time warning (BR-SH-02).*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

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