Crypto¶
Cryptographic utilities for Geometry Dash encoding.
XOR Cipher¶
gdpy.crypto.xor ¶
XOR cipher implementations for Geometry Dash encoding.
The XOR cipher is used throughout Geometry Dash for various encoding purposes, including level passwords and other data.
xor_cipher ¶
Apply XOR cipher to data using a string key.
Each character in the data is XOR'd with the corresponding character in the key, cycling through the key as needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | str | The string to encode/decode. | required |
key | str | The key to use for XOR operation. | required |
Returns:
| Type | Description |
|---|---|
str | The XOR'd result string. |
Source code in gdpy/crypto/xor.py
xor_cipher_int ¶
Apply XOR cipher to data using an integer key.
Each character in the data is XOR'd with the key value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | str | The string to encode/decode. | required |
key | int | The integer key to use for XOR operation. | required |
Returns:
| Type | Description |
|---|---|
str | The XOR'd result string. |
Example
Source code in gdpy/crypto/xor.py
GJP2 Encoding¶
gdpy.crypto.gjp ¶
GJP2 password encoding for Geometry Dash authentication.
GJP2 (Geometry Jump Password 2) is the hashing algorithm used for encoding passwords when communicating with the Geometry Dash servers.
generate_gjp2 ¶
Generate a GJP2 hash from a password.
GJP2 is used for authenticating with the Geometry Dash API. The password is salted with a fixed string and hashed using SHA-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password | str | The plaintext password to hash. | required |
Returns:
| Type | Description |
|---|---|
str | A 40-character hexadecimal SHA-1 hash string. |
Source code in gdpy/crypto/gjp.py
Checksums¶
gdpy.crypto.chk ¶
decode_rewards_response ¶
Decode the XOR'd and base64 encoded rewards response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response | str | The response from the server. | required |
key | str | XOR key to use for decoding. | '59182' |
Returns:
| Type | Description |
|---|---|
str | The decoded response string. |
Source code in gdpy/crypto/chk.py
generate_rewards_chk ¶
Generate chk parameter for rewards endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key | str | XOR key to use (19847 for challenges, 59182 for chest rewards) | '59182' |
Returns:
| Type | Description |
|---|---|
str | The chk parameter string. |