Codificar Bech32
bech32-encodeCodifica bytes hex con un prefijo legible como Bech32 (BIP-173) o Bech32m (BIP-350). Cuándo: hay que convertir bytes o texto a esta codificación, o desde ella, con exactitud y sin adivinar. No para: decodificar una cadena Bech32 o Bech32m (bech32-decode). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Encodes hex bytes with a human-readable prefix as Bech32 (BIP-173) or Bech32m (BIP-350), converting 8-bit bytes to 5-bit groups. When: bytes or text have to be converted to or from this encoding exactly, without guessing. Not for: decoding a Bech32 or Bech32m string (bech32-decode). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hrp | Yes | Human-readable part (string; required; at least 1 chars; up to 83 chars; pattern ^[!-~]+$). | |
| variant | No | Checksum variant (optional; one of: bech32, bech32m; default "bech32"). | bech32 |
| data_hex | Yes | Data bytes in hex (string; required; up to 1000 chars; pattern ^([0-9a-fA-F]{2})*$). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bech32 | No |