made it faster for bigger files, might compromise security though
This commit is contained in:
parent
78bcace8ed
commit
4537d2b3d2
1 changed files with 15 additions and 0 deletions
15
IGA.ts
15
IGA.ts
|
@ -129,6 +129,7 @@ function checksum(input: string) {
|
||||||
function hashInternal(toHash: number[], len: number, salt: number, first: boolean): number[] {
|
function hashInternal(toHash: number[], len: number, salt: number, first: boolean): number[] {
|
||||||
let complete: number[] = []
|
let complete: number[] = []
|
||||||
|
|
||||||
|
let count = 0
|
||||||
while (toHash.length > 0) {
|
while (toHash.length > 0) {
|
||||||
let inp = copy(toHash, true)
|
let inp = copy(toHash, true)
|
||||||
for (let i = 0; i < complete.length; i++) {
|
for (let i = 0; i < complete.length; i++) {
|
||||||
|
@ -159,6 +160,20 @@ function hashInternal(toHash: number[], len: number, salt: number, first: boolea
|
||||||
for (let i = 0; i < selected.length; i++) {
|
for (let i = 0; i < selected.length; i++) {
|
||||||
complete.push(selected[i])
|
complete.push(selected[i])
|
||||||
}
|
}
|
||||||
|
if (!first) {
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
count++
|
||||||
|
if (count*len >= 1024) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!first) {
|
||||||
|
for (let i = 0; i < toHash.length; i++) {
|
||||||
|
complete.push(toHash[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return complete
|
return complete
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue