---
title: Compute the identity hash
summary: Produce the deterministic SHA-256/Base64 digest shared by both the salted and unsalted operations.
status: draft
owner: SAIF Platform Team
last_reviewed: 2026-10-02
library: SAIF.NetCore.SystemHash
reference_type: package
operation_id: OP-SH-05
trigger: Called internally by ComputeHash and ComputeHashNow.
---

# 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](compute-salted-system-hash.md) or [Compute an unsalted system hash on demand](compute-unsalted-system-hash.md). |
| **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](../business-rules.md#br-sh-02-identity-string-uses-type-ordinal)).
2. Encode the identity string as UTF-16LE bytes (`Encoding.Unicode.GetBytes`) ([BR-SH-01](../business-rules.md#br-sh-01-identity-hash-encoding)).
3. Compute the SHA-256 digest of those bytes.
4. Base64-encode the digest and return it (44 characters) ([BR-SH-01](../business-rules.md#br-sh-01-identity-hash-encoding)).

## 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.

```mermaid
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](../business-rules.md#br-sh-02-identity-string-uses-type-ordinal)).*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **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`
