encode_hex
encode_hex codeert een buffer of string als een hexadecimale string met het
voorvoegsel 0x.
Invoer
| Naam | Type | Beschrijving |
|---|---|---|
value | buffer, string, addon | De te coderen buffer of string. Strings die beginnen met '0x' worden gedecodeerd als hex; anders worden onbewerkte UTF-8-bytes gebruikt. |
Uitvoer
| Naam | Type | Beschrijving |
|---|---|---|
value | string | De invoer in hexadecimale weergave met het voorvoegsel 0x |
output "encoded_hex" {value = encode_hex("hello, world")}// > encoded_hex: 0x68656c6c6f2c20776f726c64
decode_hex
decode_hex decodeert een hexadecimale string en retourneert het resultaat als
een buffer.
Invoer
| Naam | Type | Beschrijving |
|---|---|---|
hex_string | string | De te decoderen hex-string (met of zonder het voorvoegsel 0x) |
Uitvoer
| Naam | Type | Beschrijving |
|---|---|---|
value | buffer | De gedecodeerde hex-string als buffer |
output "decoded_hex" {value = decode_hex("0x68656c6c6f2c20776f726c64")}// > decoded_hex: 0x68656c6c6f2c20776f726c64
Is this page helpful?