XML file with 11 character timestamps

Viewed 185

I have been given an XML file from a client relationship database with 7 million rows. All timestamps are in this format:

<Timestamp>AAAAAAAKkVY=</Timestamp>
AAAAAAARx2M
AAAAAAAVT30

It appears the first 7 characters are always "A's" Could the last 4 digits be a HEX code or something similar? Any ideas

1 Answers

The repeated A at the beginning are Base64 encoded zeros. The length of the first string AAAAAAAKkVY= is 12, indicating that the original value is 8 bytes.

Assuming these values are representing 8-byte integers, you can do this in Python:

import struct

x = 'AAAAAAAKkVY='.decode('base64')  # Base64-decode the string
n = struct.unpack('>q', x)[0]        # Convert the bytes to an 8-byte int
print(n)

Output: 692566

The other two strings seem to be missing = padding. Adding the padding and decoding them gives:

  • AAAAAAARx2M=: 1165155
  • AAAAAAAVT30=: 1396605

Without more context, it is not really possible to know how those are timestamps. Also keep in mind that the numbers could be 8-byte floating-point value (doubles), but that's unlikely given the zeros at the beginning.

Related