[crypto.random]

crypto.random is a slot in the crypto namespace, in Hyperlambda, the language of Magic Cloud. Returns a cryptographically secure random string or random bytes.

  • Returns: Resolves to a random string, or random bytes when [raw] is true

Arguments

Required arguments come first, then the optional ones in the order they are declared.

Argument Type Required Description
[min] int no Minimum random length. Default: 10.
[max] int no Maximum random length.
[raw] bool no Whether to return raw bytes instead of encoded text. Default: false.
[seed] string no Optional deterministic seed.

Guide

How to use crypto.random

JSON declaration

This is the complete declaration of crypto.random, as the running system describes it. It is also published as slot.json.

JSON declaration
{
  "name": "crypto.random",
  "description": "Returns a cryptographically secure random string or random bytes",
  "signature": {
    "children": {
      "min": {
        "type": "int",
        "description": "Minimum random length",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrOne",
        "default": "10",
        "role": "Option",
        "projection": "Value"
      },
      "max": {
        "type": "int",
        "description": "Maximum random length",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrOne",
        "role": "Option",
        "projection": "Value"
      },
      "raw": {
        "type": "bool",
        "description": "Whether to return raw bytes instead of encoded text",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrOne",
        "default": "false",
        "role": "Option",
        "projection": "Value"
      },
      "seed": {
        "type": "string",
        "kind": "crypto-seed",
        "description": "Optional deterministic seed",
        "required": false,
        "mode": "ValueOrExpression",
        "cardinality": "ZeroOrOne",
        "role": "Option",
        "projection": "Value"
      }
    },
    "output": {
      "mode": "Value",
      "kind": "random-content,binary-content",
      "description": "Resolves to a random string, or random bytes when [raw] is true"
    }
  }
}

← crypto.password.verify all crypto.* slots crypto.random.int →