Search code examples
hexhexdumphex-editors

Deciphering some Hexcode


I'm deciphering some hexcode that I've determined are dates.

I've determined that:

50 C0 01 00 => 2014-05-21
52 C0 01 00 => 2014-05-23
59 C0 01 00 => 2014-05-30

The last byte of 00 seems to be superfluous padding. I tried applying the packing scheme that MySQL uses for dates, but that doesn't appear to work here.

Do you guys have any insight on how these dates are being packed into binary/hexcode?


Solution

  • Just a wild guess, but maybe it's going to be useful.

    If you interpret the numbers as a little-endian 32-bit integer, then:

    0x0001c050 = 114768
    

    in decimal. Also notice how a difference of one in the numbers means one day of difference. So one in the date means one day. Just out of curiosity, I've divided this 114768 by 365.25 (the average number of days in a year). That's 314.217659, which is 314 years and 79 or 80 days.

    If you count back 314 years and 80 days from 21/05/2014, then you get to 1 March, 1700. That's the fundamental date of the Gregorian system.

    So I suppose this date format is just the number of days elapsed since the Gregorian epoch.