encryption-tool-ts-fox_hunt
Version:
Ascii encryption tool for strings
28 lines • 902 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.decryptString = exports.encryptString = void 0;
function encryptString(string, encId) {
let result = "";
// Encrypt
for (let i = 0; i < string.length; i++) {
const code = string.charCodeAt(i);
const offset = code + encId;
const offsetChar = String.fromCharCode(offset);
result += offsetChar;
}
return result;
}
exports.encryptString = encryptString;
function decryptString(string, decId) {
let result = "";
// Decrypt
for (let i = 0; i < string.length; i++) {
const code = string.charCodeAt(i);
const offset = code - decId;
const offsetChar = String.fromCharCode(offset);
result += offsetChar;
}
return result;
}
exports.decryptString = decryptString;
//# sourceMappingURL=cypher.js.map