Class HashUtils
Utility class for hashing bytes into a stable, printable form.
Inherited Members
Namespace: Serenity.Shared.Utils
Assembly: Serenity.Shared.dll
Syntax
public static class HashUtils
Methods
Sha256Hex(byte[], int?)
Hashes bytes with SHA-256 and returns the digest — or a leading slice of it — as lowercase hex.
Declaration
public static string Sha256Hex(byte[] bytes, int? byteCount = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | The bytes to hash. |
| int? | byteCount | How many leading digest bytes to render as hex, or null for the full 32-byte digest. A caller that only needs a short, collision-tolerant suffix or lock name (never persisted identity spanning a full digest) can ask for fewer; clamped to the digest's own length when larger. |
Returns
| Type | Description |
|---|---|
| string | The digest hex — 64 lowercase characters for the default full digest, or |