TheKeeper81

The EncryptFindID Function

Dec 14th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string EncryptFindID (string FindTheID) //When directly using llFindNotecardTextSync, we need to (re)encrypt the string so it can find it in the encrypted notecard
  2. {
  3.     string FindIDEncrypted = llStringToBase64(FindTheID);   //Convert the text into base64
  4.     integer FindIDLength = llStringLength(FindIDEncrypted) - 1; //llGetSubString's index starts from 0, rather than 1, so we want to subtract 1 from the length to use the correct index number
  5.     string FindEqual = llGetSubString(FindIDEncrypted, FindIDLength - 1, FindIDLength); //Find the last two characters in the encrypted string
  6.     string FindSecondEqual = llGetSubString(FindIDEncrypted, FindIDLength, FindIDLength);   //Find the last character in the encrypted string
  7.    
  8.     if(FindSecondEqual == "=")  //If the last character is an equal sign
  9.     {
  10.         string FindIDEncryptedClipped = llGetSubString(FindIDEncrypted, 0, FindIDLength - 2);   //Go from index 0 up to and including the index of the second to last character; this ensures that the last character is properly clipped from the from the main string; for example, if the string were 5 characters long and we wanted to cut off the last character in the string, we'd do 5-2 to get 3, which is the second to last index when counting from 0-4
  11.        
  12.         if(FindEqual == "==")   //If the last two characters are a double equal sign
  13.         {
  14.             FindIDEncryptedClipped = llGetSubString(FindIDEncrypted, 0, FindIDLength - 3);  //Go from index 0 up to and including the third to last character to clip the last two characters off from the string
  15.             FindIDEncryptedClipped = "◆" + FindIDEncryptedClipped;  //Add the delimiter to the string, as we're looking for the string at the head of the notecard line
  16.            
  17.             return FindIDEncryptedClipped;  //Return the encrypted string with delimiter for the llFindNotecardSync to look for
  18.         }
  19.        
  20.         else
  21.         {
  22.             FindIDEncryptedClipped = "◆" + FindIDEncryptedClipped;  //Add the delimiter to the string, as we're looking for the string at the head of the notecard line
  23.        
  24.             return FindIDEncryptedClipped;  //Return the encrypted string with delimiter for the llFindNotecardSync to look for
  25.         }
  26.        
  27.     }
  28.    
  29.     else
  30.     {
  31.         FindIDEncrypted = "◆" + FindIDEncrypted;    //Add the delimiter to the string, as we're looking for the string at the head of the notecard line
  32.         return FindIDEncrypted; //Return the encrypted string with delimiter for the llFindNotecardSync to look for
  33.     }
  34. }
Add Comment
Please, Sign In to add comment