@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
51 lines (48 loc) • 1.4 kB
JavaScript
/**
* 2024-09-07: Migrated from the same folder in fps-library-v2/banner/features/Tricky/...
*/
/**
* See full file in C:\Users\me\OneDrive...\SharePoint
*/
// Need to add: ?{}[],
import { decrpt, encrpt } from './verify';
export function ecrptMeOriginalTest(str) {
let result = '';
for (var i = 0; i < str.length; i++) {
let testChar = str.charAt(i);
let idx = encrpt.indexOf(testChar);
//console.log( testChar, i, idx);
if (idx === -1) {
result += testChar;
}
else if (isOdd(i) === true) {
result += decrpt.charAt(decrpt.length - 1 - idx);
}
else {
result += decrpt.charAt(idx);
}
}
return result;
}
function isOdd(num) { return (num % 2) == 1; }
/**
* NOTE: Just swap encrpt and decrpt to reverse function
*
function ecrptMeOriginalTestX( str ) {
let result = '';
for (var i = 0; i < str.length; i++) {
let testChar = str.charAt(i);
let idx = encrpt.indexOf( testChar ) ;
//console.log( testChar, i, idx);
if ( idx === -1 ) {
result += testChar;
} else if ( isOdd(i) === true ){
result += decrpt.charAt(decrpt.length -1 - idx);
} else {
result += decrpt.charAt(idx);
}
}
return result;
}
*/
//# sourceMappingURL=logTest.js.map