Skip to content

Instantly share code, notes, and snippets.

@muromec
Created May 8, 2014 18:20
Show Gist options
  • Save muromec/c8fbc080f7a5fbd2d817 to your computer and use it in GitHub Desktop.
Save muromec/c8fbc080f7a5fbd2d817 to your computer and use it in GitHub Desktop.
Fuck. This. Crypto.
input_fd = open("key.dat", O_RDONLY);
if(input_fd < 0) {
fprintf(stderr, "failed to open data file\n");
return 1;
}
lseek(input_fd, 38, SEEK_SET);
memset(data, 0, 1024);
have = read(input_fd, data, 1024);
if(have < 100) {
fprintf(stderr, "dont have enough data: %d\n", have);
return 1;
}
lseek(input_fd, 30, SEEK_SET);
err = read(input_fd, data+have, 4);
if(err != 4) {
fprintf(stderr, "read error, dunno what to do %d\n", err);
}
close(input_fd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment