8000 Added constants with alphabet and numbers strings · sec-js/javascript-obfuscator@e625757 · GitHub
[go: up one dir, main page]

Skip to content

Commit e625757

Browse files
author
sanex3339
committed
Added constants with alphabet and numbers strings
1 parent 68ff894 commit e625757

File tree

12 files changed

+38
-18
lines changed

12 files changed

+38
-18
lines changed

dist/index.browser.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.cli.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"pre-commit": "1.2.2",
7878
"rimraf": "3.0.2",
7979
"sinon": "9.0.2",
80-
"threads": "1.6.2",
80+
"threads": "1.6.3",
8181
"ts-loader": "7.0.5",
8282
"ts-node": "8.10.2",
8383
"typescript": "3.9.5",

src/constants/AlphabetString.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const alphabetString: string = 'abcdefghijklmnopqrstuvwxyz';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { alphabetString } from './AlphabetString';
2+
3+
export const alphabetStringUppercase: string = alphabetString.toUpperCase();

src/constants/NumbersString.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const numbersString: string = '0123456789';

src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import { alphabetStringUppercase } from '../../../../constants/AlphabetStringUppercase';
2+
import { alphabetString } from '../../../../constants/AlphabetString';
3+
import { numbersString } from '../../../../constants/NumbersString';
4+
15
/**
26
* @returns {string}
37
*/
@@ -6,7 +10,7 @@ export function AtobTemplate (): string {
610
(function () {
711
{globalVariableTemplate}
812
9-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
13+
const chars = '${alphabetStringUppercase}${alphabetString}${numbersString}+/=';
1014
1115
that.atob || (
1216
that.atob = function(input) {

src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope';
66
import { IOptions } from '../../interfaces/options/IOptions';
77
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
88

9+
import { numbersString } from '../../constants/NumbersString';
10+
import { alphabetString } from '../../constants/AlphabetString';
11+
import { alphabetStringUppercase } from '../../constants/AlphabetStringUppercase';
12+
913
import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator';
1014
import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils';
1115

@@ -24,7 +28,7 @@ export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGene
2428
/**
2529
* @type {string[]}
2630
*/
27-
private static readonly nameSequence: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
31+
private static readonly nameSequence: string[] = `${numbersString}${alphabetString}${alphabetStringUppercase}`.split('');
2832

2933
/**
3034
* Reserved JS words with length of 2-4 symbols that can be possible generated with this replacer

src/utils/CryptUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
44
import { ICryptUtils } from '../interfaces/utils/ICryptUtils';
55
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
66

7+
import { alphabetStringUppercase } from '../constants/AlphabetStringUppercase';
8+
import { alphabetString } from '../constants/AlphabetString';
9+
import { numbersString } from '../constants/NumbersString';
10+
711
import { RandomGenerator } from './RandomGenerator';
812
import { Utils } from './Utils';
913

@@ -28,7 +32,7 @@ export class CryptUtils implements ICryptUtils {
2832
* @returns {string}
2933
*/
3034
public btoa (string: string): string {
31-
const chars: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
35+
const chars: string = `${alphabetStringUppercase}${alphabetString}${numbersString}+/=`;
3236

3337
let output: string = '';
3438

0 commit comments

Comments
 (0)
0