Skip to content

Instantly share code, notes, and snippets.

@b1ek
Last active September 5, 2022 00:29
Show Gist options
  • Save b1ek/b28692dd48b74be69f2a4fae52d72441 to your computer and use it in GitHub Desktop.
Save b1ek/b28692dd48b74be69f2a4fae52d72441 to your computer and use it in GitHub Desktop.
C string encryption

To edit the string, change it in the variable in the file at line 3.

import random as r, time as t

STRING = 'ur gay';
offset = r.randint(0, 10000);
encryptS = list();
c = 0;

def rands(sz): return ''.join(r.choices(list('abcdef1234567890'), k=sz));

for i in STRING:
    encryptS.append(ord(i) * offset);

s1 = 's_' + rands(8);
s2 = 's_' + rands(8);

print('// #define uint64_t unsigned long long int');
print(f'uint64_t {s1}[{len(encryptS) + 1}] = ' + str(encryptS).replace('[', '{').replace(']', '}') + ';');
print(f'char {s2}[{len(encryptS) + 1}];');
print(f'for (size_t i = 0; i != {len(encryptS)}; i++)' + ' {')
print(f'   {s2}[i] = (int) ({s1}[i] / {offset});');
print('}');
print(f'{s2}[{len(encryptS)}] = \'\\0\';');
print('\n// Your string is in variable ' + s2);
print(f'// #define string {s2}');
print('// To set the string, open the file and put your string at line 3');

while 1:
    try: t.sleep(0xffffffff);
    except KeyboardInterrupt: exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment