Base 32 Encode
Table of Contents
Description
The zoho.encryption.base32Encode task is used to encode data to base 32 format.
Syntax
<response> = zoho.encryption.base32Encode(<data>, <destination_character_set>);
where:
| Parameters | Data type | Description |
|---|---|---|
| <response> | TEXT | Variable that stores the Base32 encoded value returned as the response |
| <data> | TEXT / FILE | Represents the data that needs to be encoded |
| <destination_character_set> (Optional) | TEXT | Specifies the character set to be used for Base32 encoding. If not specified, the default character set is applied
|
Examples
Example 1: Encode a text to base 32 format
The following script encodes the text - john@zylker.com to a Base32 format using the UTF-8 character set.
response = zoho.encryption.base32Encode("john@zylker.com");
// Returns NJXWQ3SAPJ4WY23FOIXGG33N
Note: Since the <destination_character_set> parameter is not specified, the input is encoded using the default UTF-8 character set.
where:
responseThe TEXT response representing the Base32 encoded output
"john@zylker.com"The TEXT that represents the data that needs to be encoded
Example 2: Encode a file to base 32 format
The following script invokes a file from the web and encodes it to base 32 format using the UTF-16LE character set.
// Fetch a file from the web
sample_file=invokeUrl
[
url:"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
type:GET
];
// Encode the file content in UTF-16LE character set
response=zoho.encryption.base32Encode(sample_file,"UTF-16LE");
where:
responseThe TEXT response representing the Base32 encoded output
sample_fileThe FILE that holds the pdf file fetched from the web that needs to be encoded
"UTF-16LE"Specifies the character set used for encoding