← All procedures

generators.fnv1a32

The FNV-1a hash of 32 bits of a string. The option `input` selects the units that the hash reads:

CLI
Package
@procedures/generators · README
Path
["generators","fnv1a32"]
CLI
mark generators fnv1a32 --text <string>
As data
{"$proc":["generators","fnv1a32"],"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","fnv1a32"], { text: "<text>" });
console.log(JSON.stringify(result));

From the command line

$ mark generators fnv1a32 --text <string>

As data, in a program

{ "$proc": ["generators", "fnv1a32"], "input": { "text": "<text>" } }

Input

FieldTypeRequiredDefaultDescription
textstringyes
optionsobjectno

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string"
      },
      "options": {
        "type": "object",
        "properties": {
          "input": {
            "type": "string",
            "enum": [
              "utf16",
              "utf8",
              "wtf8"
            ]
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "text"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}