| 1 |
const UPPER_LIMIT = 8364; |
| 2 |
const DEFAULT_VALUE = 128; |
| 3 |
|
| 4 |
/** |
| 5 |
* Decrypts an encrypted string using a specific encryption algorithm. |
| 6 |
* |
| 7 |
* @param {string} encryptedString - The encrypted string to be decrypted. |
| 8 |
* @returns {string} The decrypted string. |
| 9 |
*/ |
| 10 |
function DeCryptString(encryptedString) { |
| 11 |
let charCode = 0; |
| 12 |
let decryptedString = "mailto:"; |
| 13 |
let encryptionKey = 0; |
| 14 |
|
| 15 |
for (let i = 0; i < encryptedString.length; i += 2) { |
| 16 |
encryptionKey = encryptedString.substr(i, 1); |
| 17 |
charCode = encryptedString.charCodeAt(i + 1); |
| 18 |
|
| 19 |
if (charCode >= UPPER_LIMIT) { |
| 20 |
charCode = DEFAULT_VALUE; |
| 21 |
} |
| 22 |
|
| 23 |
decryptedString += String.fromCharCode(charCode - encryptionKey); |
| 24 |
} |
| 25 |
|
| 26 |
return decryptedString; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Redirects the current page to the decrypted URL. |
| 31 |
* |
| 32 |
* @param {string} encryptedUrl - The encrypted URL to be decrypted and redirected to. |
| 33 |
* @return {void} |
| 34 |
*/ |
| 35 |
function DeCryptX( encryptedUrl ) |
| 36 |
{ |
| 37 |
location.href=DeCryptString( encryptedUrl ); |
| 38 |
} |