Deluge's Encoding and Encryption functions

Deluge's Encoding and Encryption functions

Hello everyone,

In this post, let us discuss the  encryption functions  available in Deluge. Deluge supports a set of built-in functions to encode, decode, encrypt, and decrypt your data using various encryption standards.

Function
Description
Applicable services
Encodes text data to base 64 format
All services
Decodes the text encoded in base 64 format
All services
Decodes the text encoded in base 64 format and stores the returned values as a file object
All services
Encrypts the input text with the specified key using Advanced Encryption Standard (AES)
All services
Decrypts the AES encrypted text using the specified key and returns the original text
All services
Encrypts the input text with the specified key using AES-128 standard
All services except Zoho Creator
Decrypts the AES-128 encrypted text using the specified key and returns the original text
All services except Zoho Creator
Returns the hash value corresponding to the given text generated using HMAC-SHA1 algorithm
All services
Returns the hash value corresponding to the given text generated using HMAC-SHA256 algorithm
All services
Returns the hash value corresponding to the given text generated using MD5 algorithm
All services
Returns the hash value corresponding to the given text generated using HMAC-SHA256 algorithm
All services
Returns the hash value corresponding to the given text, generated using SHA512 algorithm
All services
Encodes all spaces and other characters disallowed in URLs and returns the encoded text
All services
Encodes all spaces and other characters disallowed in URLs and returns the encoded text. The difference between this function and encodeUrl function is that this function returns the space character as %20, and encodeUrl function returns the space character as +.
All services except Zoho Creator
Decodes the URLencoded text returns the original text
All services except Zoho Creator
Returns the hash value corresponding to the given text generated using the SHA1 algorithm
All services except Zoho Creator




Example 1: Encode query parameters using encodeUrl function

Consider you want to add leave in Zoho People using Deluge. You can achieve this by making an API call to  Zoho People - Add leave API   using  invokeUrl task .  This API requires leave details to be supplied as query parameters. In order to send values as query parameters, the values must be URL encoded. Query parameters if supplied without being encoded may cause an internal error and affect the invokeUrl task execution.  encodeUrl  Deluge function encodes the query parameters so they contain only the characters that are allowed to be in a URL. The following script encodes the query parameters and makes an API call to add leave in Zoho People using  invokeUrl task .

  1. // Store the input query parameters in the variable - param
  2. param =  "<Request><Record><field name=\"Employee_ID\">105893000000212005</field><field name=\"From\">25-Jul-2020</field><field name=\"To\">26-Jul-2020</field><field name=\"Leavetype\">105893000000287019</field></Record></Request>";

  1. // Encode the input query param using encodeUrl function
  2. encoded_param = encodeUrl(param);

  1. // Supply the encoded query parameters to invokeUrl task
  2. response = invokeurl
  3. [
  4. url : " https://people.zoho.com/people/api/leave/records?xmlData= "+  encoded_param
  5. type :POST
  6. connection:"zoho_people_connection"
  7. ];
  8. info response;

Example 2: Generate a base64 encoded username and password that can be sent in the header of a basic authentication type API request

The following example encodes username and password using   zoho.encryption.base64Encode function and constructs a text in a format that can be sent in the header of basic authentication type API request: 

  1. // store the user name and password in the variables username and password respectively
  2. username = "shawn_123";
  3. password = "MyPassword@123";

  1. // Encode the username and password in base64 format
  2. encoded_username = zoho.encryption.base64Encode(username);
  3. encoded_password = zoho.encryption.base64Encode(password);

  1. //Structure the encoded username and password in basic authentication format. This text can be supplied as header in basic authentication type API request.
  2. basic_authentication = "basic " + encoded_username + ":" + encoded_password; //Returns basic c2hhd25fMTIz:TXlQYXNzd29yZEAxMjM=




    • Sticky Posts

    • Function #41: Sync Associated Subforms!

      Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",

      Zoho SalesIQ Resources



            Zoho TeamInbox Resources

              Zoho DataPrep Resources


                  Zoho CRM Plus Resources

                    Zoho Books Resources


                      Zoho Subscriptions Resources

                        Zoho Desk Resources

                          Zoho Projects Resources


                            Zoho Sprints Resources


                              Qntrl Resources


                                Zoho Creator Resources


                                  Zoho WorkDrive Resources




                                      Zoho Campaigns Resources

                                        Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方