-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (25 loc) · 871 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Import stylesheets
import './style.css';
import salt from './env/secret';
function encryptString(str) {
let encryptedStr = '';
for (let i = 0; i <= str.length; i++) {
encryptedStr += String.fromCharCode(str.charCodeAt(i) + 2);
}
return encryptedStr;
}
function decryptString(str) {
let decryptedStr = '';
for (let i = 0; i < str.length; i++) {
decryptedStr += String.fromCharCode(
str.charCodeAt(i) - 2 // <-- TODO: The bug is here, can you find it?
);
}
return decryptedStr;
}
let encryptedUrl = `jvvru<11tcy0ikvjwdwugteqpvgpv0eqo1kcoitcycn1fgxhguv/fgnjk/42451ockp1TGCFOG0of`;
let decryptedUrl = decryptString(encryptedUrl + salt);
// Showing the output to the browser document as well
let formLinkElement = document.getElementById('decryptedUrl');
formLinkElement.href = decryptedUrl;
formLinkElement.innerText = decryptedUrl;