Appearance
ENCODE
Encode a hexadecimal string and return a base64 value.
ENCODE('hex_string','HEX','BASE64')
- 'hex_string'
- Specify a valid hexadecimal string or an expression that evaluates to a hexadecimal string.
- 'HEX'
- Specify
HEX
(orhex
) as the input. No other input types are supported. - 'BASE64'
- Specify
BASE64
(orbase64
) as the output. No other output types are supported.
Examples
For example:
premdb=> select encode('f5e4d3c2b1a0','HEX','BASE64') from sys.const;
encode
----------
9eTTwrGg
(1 row)
In this example, the result of the HMAC_KS
function produces the input to the ENCODE
function:
premdb=> select encode(hmac_ks(nickname,playerkey,2),'hex','base64') from team order by teamid limit 3;
encode
----------------------------------------------
so9Ir6BcSA219q3jbWx5Y2ugrXsM/YG39F3hOdp5J+g=
99oaUrPWoGE6DuZUw6Ar2QDMFaCsUtatXk24TGi5I4A=
W8Apz44L4MrcAm4Bz8iCCbunokywHuvtQAzSnTI9+z8=
(3 rows)