I've read about the different versions of UUIDs available and in some UUIDs you can reverse-engineer the timestamp the UUID was generated by extracting several bits from the string.
I've successfully managed to do that for uuid1 but failed for Android and iPhone advertising ids.
I'm assuming they don't use uuid1 in that case, but what IS the UUID generating algorithm they use? can the timestamp be extracted from it?
Thanks!
in the code below you can see my failed attempt at extracting the timestamp from Android Ad ID.
from datetime import timedelta, date
def get_timestamp_from_uuid(uid):
split_uid = uid.split("-")
time_low = bin(int(split_uid[0], 16)).replace('0b', '').zfill(32)
time_mid = bin(int(split_uid[1], 16)).replace('0b', '').zfill(16)
time_high = bin(int(split_uid[2], 16)).replace('0b', '').zfill(16)[4:]
interval = int(time_high + time_mid + time_low, 2) / (10 ** 7)
return date(1582, 10, 15) + timedelta(seconds = interval)
my_uuids = [
"590512f6-16ed-11ed-9181-98e0d987bee7", # random uuid1
"07810065-6ba3-4d07-89b4-472af4a3d77f" # my android advertising id
]
get_timestamp_from_uuid(my_uuids[0])
# 2022-08-08
get_timestamp_from_uuid(my_uuids[1])
# 4557-11-04