forked from github/server
decode magellan timestamps
This commit is contained in:
parent
dd3054de73
commit
341bd961f5
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue