forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed wrong
source-map: 'inline'
encoding after 1.3.0
- Loading branch information
sanex3339
committed
Jul 10, 2020
1 parent
514e34b
commit c688746
Showing
20 changed files
with
154 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { alphabetStringUppercase } from './AlphabetStringUppercase'; | ||
import { alphabetString } from './AlphabetString'; | ||
import { numbersString } from './NumbersString'; | ||
|
||
export const base64alphabet: string = `${alphabetStringUppercase}${alphabetString}${numbersString}+/=`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { alphabetStringUppercase } from './AlphabetStringUppercase'; | ||
import { alphabetString } from './AlphabetString'; | ||
import { numbersString } from './NumbersString'; | ||
|
||
/** | ||
* Swapped lowercase and uppercase groups of alphabet to prevent easy decode | ||
*/ | ||
export const base64alphabetSwapped: string = `${alphabetString}${alphabetStringUppercase}${numbersString}+/=`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* eslint-disable @typescript-eslint/no-empty-interface */ | ||
import { ICryptUtils } from './ICryptUtils'; | ||
|
||
export interface ICryptUtilsSwappedAlphabet extends ICryptUtils {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { inject, injectable } from 'inversify'; | ||
import { ServiceIdentifiers } from '../container/ServiceIdentifiers'; | ||
|
||
import { ICryptUtilsSwappedAlphabet } from '../interfaces/utils/ICryptUtilsSwappedAlphabet'; | ||
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator'; | ||
|
||
import { base64alphabetSwapped } from '../constants/Base64AlphabetSwapped'; | ||
|
||
import { CryptUtils } from './CryptUtils'; | ||
|
||
@injectable() | ||
export class CryptUtilsSwappedAlphabet extends CryptUtils implements ICryptUtilsSwappedAlphabet { | ||
/** | ||
* @type {string} | ||
*/ | ||
protected readonly base64Alphabet: string = base64alphabetSwapped; | ||
|
||
/** | ||
* @param {IRandomGenerator} randomGenerator | ||
*/ | ||
public constructor ( | ||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator | ||
) { | ||
super(randomGenerator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'reflect-metadata'; | ||
|
||
import { assert } from 'chai'; | ||
|
||
import { ServiceIdentifiers } from '../../../src/container/ServiceIdentifiers'; | ||
|
||
import { ICryptUtilsSwappedAlphabet } from '../../../src/interfaces/utils/ICryptUtilsSwappedAlphabet'; | ||
import { IInversifyContainerFacade } from '../../../src/interfaces/container/IInversifyContainerFacade'; | ||
|
||
import { InversifyContainerFacade } from '../../../src/container/InversifyContainerFacade'; | ||
|
||
import { swapLettersCase } from '../../helpers/swapLettersCase'; | ||
|
||
describe('CryptUtilsSwappedAlphabet', () => { | ||
let cryptUtilsSwappedAlphabet: ICryptUtilsSwappedAlphabet; | ||
|
||
before(() => { | ||
const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); | ||
|
||
inversifyContainerFacade.load('', '', {}); | ||
cryptUtilsSwappedAlphabet = inversifyContainerFacade | ||
.get<ICryptUtilsSwappedAlphabet>(ServiceIdentifiers.ICryptUtilsSwappedAlphabet); | ||
}); | ||
|
||
describe('btoa', () => { | ||
const expectedString: string = swapLettersCase('c3RyaW5n'); | ||
|
||
let string: string; | ||
|
||
before(() => { | ||
string = cryptUtilsSwappedAlphabet.btoa('string'); | ||
}); | ||
|
||
it('should create a base-64 encoded string with swapped alphabet from a given string', () => { | ||
assert.equal(string, expectedString); | ||
}); | ||
}); | ||
|
||
describe('rc4', () => { | ||
const string: string = 'test'; | ||
const key: string = 'key'; | ||
|
||
let encodedString: string, | ||
decodedString: string; | ||
|
||
before(() => { | ||
encodedString = cryptUtilsSwappedAlphabet.rc4(string, key); | ||
decodedString = cryptUtilsSwappedAlphabet.rc4(encodedString, key); | ||
}); | ||
|
||
it('should encode string using the rc4 algorithm', () => { | ||
assert.notEqual(encodedString, string); | ||
}); | ||
|
||
it('should encode and successfully decode string using the rc4 algorithm', () => { | ||
assert.equal(decodedString, string); | ||
}); | ||
}); | ||
}); |