decode magellan timestamps

This commit is contained in:
Enno Rehling 2009-07-26 18:10:37 +00:00
parent dd3054de73
commit 341bd961f5
1 changed files with 23 additions and 0 deletions

23
src/tools/gethash.c Normal file
View File

@ -0,0 +1,23 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char ** argv)
{
char key[4];
char code[4];
char result[4];
int a, i, rot;
for (a=1;a<argc;++a) {
const char * str = argv[a];
size_t len = strlen(str);
str = str+len-6;
memcpy(key, str, 3);
memcpy(code, str+3, 3);
result[3] = key[3] = code[3] = 0;
rot=atoi(key);
for(i=0;i!=3;++i) result[(i+rot)%3] = ((code[i]+10-key[i])%10)+'0';
printf("%s %s\n", argv[a], result);
}
return 0;
}