blob: b13593d5eb29991c90899cb058d109d7a584aa9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/**
* SPDX-License-Identifier: CC0-1.0
*
* Copyright (C) 2026 Woj. Kosior <koszko@koszko.org>
*/
/*
#+begin_src manifest-jq
.matches = ["<all_urls>"]
#+end_src
*/
/*
* This is a counting schemes definition for use with `pow-solver.js'. It is
* used by multiple content scripts.
*/
const appendedNumberCountingSchemes = (() => {
const ascii0 = 48;
const ascii9 = 57;
function stepArray(array, by) {
let idx = array.length - 1;
while (true) {
const byte = array[idx] += by;
if (byte > ascii9) {
array[idx] = ascii0;
by = 1;
} else if (byte < ascii0) {
array[idx] = ascii9;
by = -1;
} else {
break;
}
idx--;
}
}
return [
/*
* In Anubis, server parses suffix as Int which might be a signed 32-bit
* type.
*/
{
makeArray: randomData => randomData + '2147483647',
stepArray: array => stepArray(array, -1),
suffixLength: () => '2147483647'.length
},
{
makeArray: randomData => randomData + '1000000000',
stepArray: array => stepArray(array, 1),
suffixLength: () => '1000000000'.length
}
];
})();
|