voidstar0/bpre

akamai: bmak.z1, bmak.d2, bmak.d2 / 6

voidstar0 opened this issue · 3 comments

What's Happening

bmak.start_ts is the starting timestamp of the script in milliseconds (Date.now)
bmak.y1 is defined as 2016
bmak.pi is an alias for parseInt

The bmak.z1 variable is assigned as follows:

bmak.z1 = bmak.pi(bmak.start_ts / (bmak.y1 * bmak.y1));

and can be rewritten as:

// 2016 * 2016 = 4064256
bmak.z1 = parseInt(bmak.start_ts / (2016 * 2016));

In a seperate function (bmak.bd), bmak.z1 is divided by 23 and assigned to bmak.d2:

bmak.d2 = bmak.pi(bmak.z1 / 23);

Finally, while sensor data is being crafted in bmak.bpd, bmak.d2 is being divided by 6.

f = bmak.pi(bmak.d2 / 6)

Questions

  • What is the significance of dividing the start timestamp by 4064256
  • What is the significance of dividing the result of that by 23
  • What is the significance of dividing the result of that by 6
xssc commented

My theory for these is bmak.z1 is divided by 4064256 (and submitted in the sensor data) to create an "hour identifier", dividing by 4064256 and parsing as an int gives you a number that should be constant for all valid sensor datas, but changes every ~hour (4064256ms is 67 minutes 44.256 seconds, not sure why this wouldnt be exactly 60 min but close enough i guess)

so now we have an "hour identifier", d2 now divides by 23, which gives us, again roughly, a day marker, as diving the "hour marker" by 23, will result in a number that changes roughly every day (maybe this is 23 not 24 because our 7 extra minutes is now an extra 2.96608 hours in the timeframe)

now the 6, if the above is true, clearly this is the "week identifier", the number changes roughly once every week (maybe 6 because now the extra room in the timeframe is 17.79648 hours)

all 3 can be used individually to identify a timeframe, and all 3 are individually submitted in the sensor data, not sure if there is a reason for it being slightly not-exact to hours, day, week timeframes

Here is a script to see how each part changes as the timestamp changes

const testDates = [
    Date.now(),
    Date.now() + (1000 * 2), // 2 seconds (to show nothing changes)
    Date.now() + (1000 * 60 * 68), // 68 mins
    Date.now() + (1000 * 60 * 68 * 23), // 68 mins * 23 hours
    Date.now() + (1000 * 60 * 68 * 23 * 6) // 68 mins * 23 hours * 6 days,
];

testDates.forEach(ts => {
    bmak = {start_ts: ts};
    bmak.z1 = parseInt(bmak.start_ts / (2016 * 2016));

    bmak.d2 = parseInt(bmak.z1 / 23);

    bmak._f = parseInt(bmak.d2 / 6);
    console.log(bmak);
});

Can't tell if it's clever or silly on their part.

Sounds about right though. Thnx!

Added in #3