Skip to content

Commit 70f42c2

Browse files
committed
remove repeated information
1 parent 370e5c4 commit 70f42c2

File tree

3 files changed

+3
-54
lines changed

3 files changed

+3
-54
lines changed

docs/_sidebar.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- [AES](/topics/Algorithms/AES.md)
2929
- [Base64](/topics/Algorithms/base64.md)
3030
- [XOR](/topics/Algorithms/Xor.md)
31+
- [Robtop Cipher](/topics/Algorithms/robtop-cipher.md)
3132

3233
- [Client]()
3334
- [Tags](/Topics/client/tags)

docs/reference/keys.md

+1-34
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,9 @@
2222

2323
## XOR Types
2424

25-
> <u>There are **two** ways Geometry Dash applies [XOR Cipher](#) to strings - **Static** and **Cycled**</u>
25+
> there are **two** ways Geometry Dash applies [XOR Cipher](topics/algorithms/xor.md) to strings - **Static** and **Cycled**
2626
>
2727
> - Static Ciphers apply the key as is without any changes applying to the key itself.
2828
> - Cycled Ciphers iterate through each value on the key one by one and then loops back once it reaches the end.
2929
30-
## XOR Example
3130

32-
> *Below are XOR functions for both variations. They are written in javascript for the sake of simplicity*
33-
34-
<!-- tabs:start -->
35-
36-
### **Static**
37-
38-
```js
39-
function xor_static(key, string) {
40-
let result = "";
41-
for (let i = 0; i < string.length; i++) {
42-
let input = string.charCodeAt(i);
43-
result += String.fromCharCode(input ^ key);
44-
}
45-
return result;
46-
}
47-
```
48-
49-
### **Cycle**
50-
51-
```js
52-
function xor_cycle(key, string) {
53-
let result = "";
54-
for (let i = 0; i < string.length; i++) {
55-
let input = string.charCodeAt(i);
56-
let xKey = key.charCodeAt(i % key.length);
57-
result += String.fromCharCode(input ^ xKey);
58-
}
59-
return result;
60-
}
61-
```
62-
63-
<!-- tabs:end -->

docs/topics/Algorithms/robtop-cipher.md

+1-20
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,4 @@ Within the cyclic XOR RobTop Cipher (the most common variant), the key should be
5555
The differentiating factor between cyclic and static XOR is that cyclic XOR uses a key longer than one byte. This means that the key has to be
5656
repeatedly looped over during the string iteration.
5757

58-
This idea can be demonstrated within the pseudocode:
59-
```js
60-
plaintext = "value to encode"
61-
xor_key = "..." // The XOR Key from the key reference material.
62-
63-
function cyclic_xor(text, key) {
64-
key_length = key.length
65-
result = "" // The final result will be stored here
66-
for (idx = 0; idx < plaintext; idx++) {
67-
cur_key_byte = into_utf8_code(key[idx % key_length]) // The key may be shorter than the text, so we loop over it. Hence the name "cyclic".
68-
cur_char_byte = into_utf8_code(text[idx])
69-
result += from_utf8_code(cur_char_byte ^ cur_key_byte)
70-
}
71-
return result
72-
}
73-
74-
ciphertext = cyclic_xor(plaintext, xor_key)
75-
```
76-
77-
Likewise, decoding involves the same process as encoding.
58+
Please refer to the [XOR](/topics/algorithms/xor.md) section for details on the implementation

0 commit comments

Comments
 (0)