LanguageValues and typesStandard typesSecurity
Hash
On this page
A SHA-256 digest: the 32 bytes hash.sha256 gives.
Use it to spot changed content or to keep a fingerprint of a key. For a password, use PasswordHash. For a signature with a key, use Hmac.
Shape
One value, held as bytes, with no parts. As text it reads ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=.
Example
Hash(hash.sha256("hello"))Hash(bytes) checks them, and bytes that aren't one break the format rule.
text.parse(raw, as: Hash) reads one from text that comes from outside. Text that isn't one at all fails malformed.
Good to know
==on two of them takes the same time wherever they differ, so it leaks nothing.- JSON sends it as Base64.
==tells you whether two are the same.<andlist.sort_bydon't take it.
In JSON
A string, in a request, a response or json.write:
"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=""ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="
Details
Text form, storage, how it is shown, and operations
Hash is in the group Security, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= and ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=.
How it is stored
It is stored in one column named for the field, of type bytea. ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= is stored as E'\\xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'::bytea.
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= |
47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= |
ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= |
ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0= |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-hash.md.Built from Jadpo main at aee2e8f.