Converts an input value to base64 encoding with optional padding with an equals sign ( |
Typically, base64 is used to transmit binary information, such as images, over transfer methods that use text, such as HTTP.
NOTE: base64 is not an effective method of encryption. |
Column reference example:
base64encode(mySource) |
Output: Returns the values from the mySource
column written in base64 format.
String literal example:
base64encode('Hello, World. ', true) |
Output: Returns the string: GVsbG8sIFdvcmxkLiA=
. Note that the output string is padded with the equals sign at the end of the output value.
base64encode(column_string,bool_padding) |
Argument | Required? | Data Type | Description |
---|---|---|---|
column_string | Y | string | Name of the column or string literal to be applied to the function |
bool_padding | N | Boolean | When true , excess padding in the data stream is padded with an equals sign ( = ) in the output. Default is true . |
Name of the column or string constant to be converted.
'Hello, World'
).
Required? | Data Type | Example Value |
---|---|---|
Yes | String literal or column reference | myColumn |
Boolean value that determines if spaces are padded with the equals sign.
Base64 represents six-bit values (0-63). These values are represented in encoded values as ASCII characters, which are 8-bit values (0-255).
For any arbitrary input, it is possible that the number of bits required to represent it as a base64 value (number of characters * 6) won't precisely match up ASCII representation. Four sextets of base64 encoding map to three octets of ASCII encoding. If the input string has been fully encoded, but there are extra ASCII octets so that the number of output octets is divisible by four.
When this parameter is set to true
, the output value is padded with the equals sign (=
) to represent output octets that are generated but do not contain any data encoded from the input. The default is true
.
For more information on base64 padding, see https://en.wikipedia.org/wiki/Base64.
Required? | Data Type | Example Value |
---|---|---|
No | Boolean | false
|