updates people updates
This commit is contained in:
42
training/htb/challenges/rev/solve.c
Normal file
42
training/htb/challenges/rev/solve.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
|
||||
char rolling_xor(char *key, char* encrypted_data)
|
||||
{
|
||||
char* v0 = key;
|
||||
int v1 = 0;
|
||||
char *i = encrypted_data;
|
||||
char result;
|
||||
|
||||
for ( ; *i; ++i )
|
||||
{
|
||||
result = *v0;
|
||||
*i ^= *v0++;
|
||||
if ( ++v1 == 8 )
|
||||
{
|
||||
v0 = key;
|
||||
v1 = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(){
|
||||
char encrypted_data[] =
|
||||
{
|
||||
0x09, 0x07, 0x11, 0x48, 0x20, 0x73, 0x02, 0x68, 0x2C, 0x67,
|
||||
0x62, 0x02, 0x3E, 0x36, 0x7D, 0x1A, 0x1E, 0x35, 0x1F, 0x07,
|
||||
0x2A, 0x1D, 0x3C, 0x0B, 0x71, 0x25, 0x62, 0x57, 0x7E, 0x30,
|
||||
0x13, 0x3B, 0x71, 0x07, 0x2E, 0x00
|
||||
};
|
||||
|
||||
char key[] =
|
||||
{
|
||||
0x52, 0x4A, 0x4A, 0x33, 0x44, 0x53, 0x43, 0x50, 0x00
|
||||
};
|
||||
|
||||
|
||||
rolling_xor(key, encrypted_data);
|
||||
|
||||
printf("decrypted: %s\n", encrypted_data);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user