StringArrayCallsWrapperRc4CodeHelper.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { injectable, } from 'inversify';
  2. import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplate';
  3. import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template';
  4. import { StringArrayRC4DecodeTemplate } from './templates/string-array-calls-wrapper/StringArrayRC4DecodeTemplate';
  5. import { StringArrayCallsWrapperCodeHelper } from './StringArrayCallsWrapperCodeHelper';
  6. @injectable()
  7. export class StringArrayCallsWrapperRc4CodeHelper extends StringArrayCallsWrapperCodeHelper {
  8. /**
  9. * @returns {string}
  10. */
  11. protected override getDecodeStringArrayTemplate (): string {
  12. const atobFunctionName: string = this.randomGenerator.getRandomString(6);
  13. const rc4FunctionName: string = this.randomGenerator.getRandomString(6);
  14. const atobPolyfill: string = this.customCodeHelperFormatter.formatTemplate(AtobTemplate(), {
  15. atobFunctionName
  16. });
  17. const rc4Polyfill: string = this.customCodeHelperFormatter.formatTemplate(Rc4Template(), {
  18. atobFunctionName,
  19. rc4FunctionName
  20. });
  21. const selfDefendingCode: string = this.getSelfDefendingTemplate();
  22. return this.customCodeHelperFormatter.formatTemplate(
  23. StringArrayRC4DecodeTemplate(this.randomGenerator),
  24. {
  25. atobPolyfill,
  26. rc4FunctionName,
  27. rc4Polyfill,
  28. selfDefendingCode,
  29. stringArrayName: this.stringArrayName,
  30. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  31. stringArrayCacheName: this.stringArrayCacheName
  32. }
  33. );
  34. }
  35. }