Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
483 B
8
Indexable
Never
#include <stdio.h>
#include <string.h>

const unsigned char key[] = "";
int idx = 0;

unsigned char c2e(char c) {
    unsigned char r = c ^ key[idx];
    idx = (idx + 1) % strlen(key);
    return r;
}

int main(int argc, char* argv[]) {
    if(argc != 2) return - 1;
    FILE *f = fopen(argv[1], "r");
    int i = 1;
    while(!feof(f)) {
        unsigned char c = c2e(fgetc(f));
        printf("%02X", c);
        if(i++ % 20 == 0) printf("\n");
    }
    fclose(f);
    return 0;
}