Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change Log
v5.6.0
---
* Pro API: `obfuscatePro` now fall back to the basic local obfuscation API when no Pro feature (`vmObfuscation` or `parseHtml`) is enabled, instead of throwing an `ApiError`
* Improved `stringArrayEncoding` runtime performance

v5.5.1
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,32 @@ export function StringArrayBase64DecodeTemplate(randomGenerator: IRandomGenerato
const initializedIdentifier: string = randomGenerator.getRandomString(identifierLength);
const base64Identifier: string = randomGenerator.getRandomString(identifierLength);
const dataIdentifier: string = randomGenerator.getRandomString(identifierLength);
const cacheStateIdentifier: string = randomGenerator.getRandomString(identifierLength);

return `
if ({stringArrayCallsWrapperName}.${initializedIdentifier} === undefined) {
{atobPolyfill}
{stringArrayCallsWrapperName}.${base64Identifier} = {atobFunctionName};

{stringArrayCallsWrapperName}.${dataIdentifier} = {};

{stringArrayCallsWrapperName}.${initializedIdentifier} = true;
}

const firstValue = stringArray[0];
const cacheKey = index + firstValue;
const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[cacheKey];

if (!cachedValue) {

if ({stringArrayCallsWrapperName}.${cacheStateIdentifier} !== firstValue) {
{stringArrayCallsWrapperName}.${dataIdentifier} = {};
{stringArrayCallsWrapperName}.${cacheStateIdentifier} = firstValue;
}

const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[index];

if (cachedValue === undefined) {
{selfDefendingCode}

value = {stringArrayCallsWrapperName}.${base64Identifier}(value);
{stringArrayCallsWrapperName}.${dataIdentifier}[cacheKey] = value;
{stringArrayCallsWrapperName}.${dataIdentifier}[index] = value;
} else {
value = cachedValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,37 @@ export function StringArrayRC4DecodeTemplate(randomGenerator: IRandomGenerator):
const rc4Identifier: string = randomGenerator.getRandomString(identifierLength);
const dataIdentifier: string = randomGenerator.getRandomString(identifierLength);
const onceIdentifier: string = randomGenerator.getRandomString(identifierLength);
const cacheStateIdentifier: string = randomGenerator.getRandomString(identifierLength);

return `
if ({stringArrayCallsWrapperName}.${initializedIdentifier} === undefined) {
{atobPolyfill}
{rc4Polyfill}
{stringArrayCallsWrapperName}.${rc4Identifier} = {rc4FunctionName};

{stringArrayCallsWrapperName}.${dataIdentifier} = {};

{stringArrayCallsWrapperName}.${initializedIdentifier} = true;
}

const firstValue = stringArray[0];
const cacheKey = index + firstValue;
const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[cacheKey];

if (!cachedValue) {
if ({stringArrayCallsWrapperName}.${cacheStateIdentifier} !== firstValue) {
{stringArrayCallsWrapperName}.${dataIdentifier} = {};
{stringArrayCallsWrapperName}.${cacheStateIdentifier} = firstValue;
}

const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[index];

if (cachedValue === undefined) {
if ({stringArrayCallsWrapperName}.${onceIdentifier} === undefined) {
{selfDefendingCode}

{stringArrayCallsWrapperName}.${onceIdentifier} = true;
}

value = {stringArrayCallsWrapperName}.${rc4Identifier}(value, key);
{stringArrayCallsWrapperName}.${dataIdentifier}[cacheKey] = value;
{stringArrayCallsWrapperName}.${dataIdentifier}[index] = value;
} else {
value = cachedValue;
}
Expand Down
Loading