INNER CODE UNIT · JavaScript
wrapEnd
jofpin/temcrypt · temcrypt.js:383
let wrapEnd = initialData.substring(initialData.length - currentStep);
let wrappedData = wrapEnd + initialData.substring(currentStep, initialData.length - currentStep) + wrapStart;
let reverseWrappedData = wrappedData.split("").reverse().join("");
const averageTime = (new Date() - this.core.date.CURRENT) / 1000;
if (averageTime > maxSteps || this.baseTime().seconds === "00") {
return {
status: false,
error_code: this.core.IMPORTANT_ERRORS.DECRYPTION_EXCEEDED.code,
message: this.core.IMPORTANT_ERRORS.DECRYPTION_EXCEEDED.message
};
}
try {
let decryptionLayerOne = this.helper(CryptoJS.enc.Hex.parse(reverseWrappedData).toString(CryptoJS.enc.Utf8)).dec256(this.helper().splitKey(mainKeyComposition).two);
let decryptionLayerTwo = this.helper(decryptionLayerOne).dec256(this.helper().splitKey(mainKeyComposition).one);
let decryptedData = JSON.parse(decryptionLayerTwo);