encode_hex
encode_hex codifica um buffer ou string como uma string hexadecimal com
prefixo 0x.
Entradas
| Nome | Tipo | Descrição |
|---|---|---|
value | buffer, string, addon | O buffer ou string a ser codificado. Strings iniciadas com '0x' são decodificadas como hex; caso contrário, os bytes UTF-8 brutos são utilizados. |
Saída
| Nome | Tipo | Descrição |
|---|---|---|
value | string | A entrada em sua representação hexadecimal com prefixo 0x |
output "encoded_hex" {value = encode_hex("hello, world")}// > encoded_hex: 0x68656c6c6f2c20776f726c64
decode_hex
decode_hex decodifica uma string hexadecimal e retorna o resultado como um
buffer.
Entradas
| Nome | Tipo | Descrição |
|---|---|---|
hex_string | string | A string hex a ser decodificada (com ou sem prefixo 0x) |
Saída
| Nome | Tipo | Descrição |
|---|---|---|
value | buffer | A string hex decodificada como um buffer |
output "decoded_hex" {value = decode_hex("0x68656c6c6f2c20776f726c64")}// > decoded_hex: 0x68656c6c6f2c20776f726c64
Is this page helpful?