-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkey.sprak
96 lines (89 loc) · 3.26 KB
/
key.sprak
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# mode accepts an integer with a value >= 1 <= 5 and alters the order in which values in the range are tried.
number mode = 0
# list accepts an array containing integer values separated by a comma and space each and together delimited by square brackets.
array list = [-1, 0, 13, 344, 666, 1111, 1234, 1337, 2358, 4991, 5611, 7471, 7472, 9788, 34711, 45914, 54321, 112358, 424242, 38984312]
# denominator accepts an integer with a value > 0 and is used as a constant in modes 3 and 4.
number denominator = 100
# max accepts an integer with a value > min and represents the upper limit of the range of numbers to be tried.
number max = 100000
# max accepts an integer with a value < max and represents the lower limit of the range of numbers to be tried.
number min = 0
# increment accepts an integer with a positive value and is used as a constant in mode 6. The value I used is the a prime number nearest to (max + min) / 4 which seems to produce random enough values.
number increment = 24989
# seed accepts an integer with a value < max and represents the starting value used in the PRNG.
number seed = max - 1
# Tries values in the list array.
if mode == 0
loop value in list
if Toggle(value) == true
break
end
end
end
# Tries values in the range in order.
if mode == 1
loop value from min to max
if Toggle(value) == true
break
end
end
end
# Tries values in the range in reverse.
if mode == 2
loop value from min to max
if Toggle((min + max) - value) == true
break
end
end
end
# Alternates between the remaining untried highest and lowest values in the range until the middle or correct value is reached.
if mode == 3
loop value from min to max
if (Mod(value, 2) == 0)
value = max - value
end
if value == (min + max) / 2
break
end
if Toggle(value) == true
break
end
end
end
# Divides the range by denominator and tries values in each fragment in reverse, doing so until the correct value is reached or the range is exhausted.
if mode == 4
loop numerator from 1 to denominator
loop value from Int(((numerator - 1) * (max - min)) / denominator) to Int((numerator * (max - min)) / denominator)
if Toggle((Int((numerator * (max - min)) / denominator) + Int(((numerator - 1) * (max - min)) / denominator)) - value) == true
break
break
end
end
end
end
# Divides the range by denominator and alternates between the remaining untried highest and lowest values for each fragment, moving to the next fragment when the middle value of the current fragment is reached, doing so until the correct value is reached or the range is exhausted.
if mode == 5
loop numerator from 1 to denominator
loop value from Int(((numerator - 1) * (max - min)) / denominator) to Int((numerator * (max - min)) / denominator)
if (Mod(value, 2) == 0)
value = Int((numerator * (max - min)) / denominator) - (value - Int(((numerator - 1) * (max - min)) / denominator))
end
if value == (Int(((numerator - 1) * (max - min)) / denominator) + Int((numerator * (max - min)) / denominator)) / 2
break
end
if Toggle(value) == true
break
break
end
end
end
end
# Tries values in the range in pseudo-random order using a form of linear congruential generator.
if mode == 6
loop
seed = Mod((seed + increment), max)
if Toggle(seed) == true
break
end
end
end