encode_hex
encode_hex는 버퍼 또는 문자열을 0x 접두사가 붙은 16진수 문자열로 인코딩합니다.
입력
| 이름 | 타입 | 설명 |
|---|---|---|
value | buffer, string, addon | 인코딩할 버퍼 또는 문자열. '0x'로 시작하는 문자열은 16진수로 디코딩되며, 그렇지 않으면 원시 UTF-8 바이트가 사용됩니다. |
출력
| 이름 | 타입 | 설명 |
|---|---|---|
value | string | 0x 접두사가 붙은 16진수 표현의 입력값 |
output "encoded_hex" {value = encode_hex("hello, world")}// > encoded_hex: 0x68656c6c6f2c20776f726c64
decode_hex
decode_hex는 16진수 문자열을 디코딩하여 결과를 버퍼로 반환합니다.
입력
| 이름 | 타입 | 설명 |
|---|---|---|
hex_string | string | 디코딩할 16진수 문자열 (0x 접두사 포함 여부 무관) |
출력
| 이름 | 타입 | 설명 |
|---|---|---|
value | buffer | 버퍼로 변환된 디코딩된 16진수 문자열 |
output "decoded_hex" {value = decode_hex("0x68656c6c6f2c20776f726c64")}// > decoded_hex: 0x68656c6c6f2c20776f726c64
Is this page helpful?