如何解码这个6字节的日期时间格式?

时间:2017-02-18 14:53:27

标签: datetime encoding hex

我有以下已知的十六进制值和日期对:

4e754e473248 -> 23:56:23 16/02/2017
4e764e473248 -> 23:57:23 16/02/2017
4e784e473248 -> 23:59:23 16/02/2017
304162483248 -> 00:10:37 17/02/2017
304262483248 -> 00:11:37 17/02/2017
30456f483248 -> 00:14:50 17/02/2017

我无法弄清楚如何从一个转换为另一个。有没有人认识到这种十六进制编码格式?

通过收集数百对,我来到了下面的映射。映射适用于小时,分钟,秒。他们也持有一天,一个月和一年,虽然我无法长时间测试月份和年份。请注意,由于某种原因,序列中的某些数字会被跳过。

第一列是解码值,其他列是不同基数的编码值。

deco dc   hx     binary
-----------------------
00:  48 - 30 - 00110000
01:  49 - 31 - 00110001
02:  50 - 32 - 00110010
03:  51 - 33 - 00110011
04:  52 - 34 - 00110100
05:  53 - 35 - 00110101
06:  54 - 36 - 00110110
07:  55 - 37 - 00110111
08:  56 - 38 - 00111000
09:  57 - 39 - 00111001 <- jump
10:  65 - 41 - 01000001
11:  66 - 42 - 01000010
12:  67 - 43 - 01000011
13:  68 - 44 - 01000100
14:  69 - 45 - 01000101
15:  70 - 46 - 01000110
16:  71 - 47 - 01000111
17:  72 - 48 - 01001000
18:  73 - 49 - 01001001
19:  74 - 4a - 01001010
20:  75 - 4b - 01001011
21:  76 - 4c - 01001100
22:  77 - 4d - 01001101
23:  78 - 4e - 01001110 <- this is the maximum observed value for hours
24:  79 - 4f - 01001111
25:  80 - 50 - 01010000
26:  81 - 51 - 01010001
27:  82 - 52 - 01010010
28:  83 - 53 - 01010011
29:  84 - 54 - 01010100
30:  85 - 55 - 01010101
31:  86 - 56 - 01010110
32:  87 - 57 - 01010111
33:  88 - 58 - 01011000
34:  89 - 59 - 01011001
35:  90 - 5a - 01011010 <- jump
36:  97 - 61 - 01100001
37:  98 - 62 - 01100010
38:  99 - 63 - 01100011
39: 100 - 64 - 01100100
40: 101 - 65 - 01100101
41: 102 - 66 - 01100110
42: 103 - 67 - 01100111
43: 104 - 68 - 01101000
44: 105 - 69 - 01101001
45: 106 - 6a - 01101010
46: 107 - 6b - 01101011
47: 108 - 6c - 01101100
48: 109 - 6d - 01101101
49: 110 - 6e - 01101110
50: 111 - 6f - 01101111
51: 112 - 70 - 01110000
52: 113 - 71 - 01110001
53: 114 - 72 - 01110010
54: 115 - 73 - 01110011
55: 116 - 74 - 01110100
56: 117 - 75 - 01110101
57: 118 - 76 - 01110110
58: 119 - 77 - 01110111
59: 120 - 78 - 01111000

1 个答案:

答案 0 :(得分:4)

您的表格可以概括为

'0' through '9' (hex 30 through 39) = 0 through 9
'A' through 'Z' (hex 41 through 5A) = 10 through 35
'a' through 'z' (hex 61 through 7A) = 36 through 61

跳转是为了使编码值始终为字母数字。