Base 32 Encode

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:

ParametersData typeDescription
<response>TEXTVariable that stores the Base32 encoded value returned as the response
<data>TEXT / FILERepresents 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

Supported Values

  • UTF-8 (Default)
  • UTF-16LE
  • UTF-16BE

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:

response
The 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:

response
The TEXT response representing the Base32 encoded output
sample_file
The FILE that holds the pdf file fetched from the web that needs to be encoded
"UTF-16LE"
Specifies the character set used for encoding

Related links