generators.sha256Hex
This function gives the SHA-256 digest of the bytes of a string, as 64 lowercase hex characters. The option `input` selects the bytes of a lone surrogate. It is not for passwords: it has no salt and no cost.
CLI- Package
- @procedures/generators · README
- Path
["generators","sha256Hex"]- CLI
mark generators sha256Hex --text <string>- As data
{"$proc":["generators","sha256Hex"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/generators/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["generators","sha256Hex"], { text: "<text>" });
console.log(JSON.stringify(result));From the command line
$ mark generators sha256Hex --text <string>
As data, in a program
{ "$proc": ["generators", "sha256Hex"], "input": { "text": "<text>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | yes | ||
options | object | no |
Output
The schema does not list fields (string).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"options": {
"type": "object",
"properties": {
"input": {
"type": "string",
"enum": [
"utf8",
"wtf8"
],
"description": "The bytes that the hash reads, as in `fnv1a32`:"
}
},
"additionalProperties": {}
}
},
"required": [
"text"
],
"additionalProperties": false
},
"output": {
"type": "string"
}
}