Skip to main content
. 2024 Jun 8;24(12):3735. doi: 10.3390/s24123735
Algorithm 2 Telemetry Data Hash
  • function SendRequestData

  •      timestamp Current datetime

  •      resp Request headers as dictionary

  •      telemetry_hash ‘N/A’

  •      Initialize database cursor conn

  •      if Request method is ‘POST’ then

  •          Retrieve telemetry data between interaction start and current timestamp

  •          data Fetched data

  •          if data is not empty then

  •             Initialize telemetry_str, key_timestamps, total_time_diff, count

  •             for each entry d in data do

  •                if d[3] is ‘mouse’ then

  •                    Append mouse coordinates to telemetry_str

  •                else if d[3] is ‘keyboard’ then

  •                    Add d[4] to key_timestamps

  •                end if

  •             end for

  •             Calculate average time between key presses

  •             Append average time to telemetry_str

  •             Compute hash of telemetry_str

  •          end if

  •          Insert request data into the database

  •     end if

  •     Commit changes to the database

  •     Close database connection

  • end function