blueetothNameAnoymizer function

Data blueetothNameAnoymizer(
  1. Data datum
)

A Bluetooth anonymizer function. Anonymizes the name and discovery name of each discovered bluetooth device. Bluetooth devices' names may contain participants' real name because people use their names to name their computers and phones.

Implementation

Data blueetothNameAnoymizer(Data datum) {
  assert(datum is Bluetooth);
  Bluetooth bt = datum as Bluetooth;
  for (var result in bt.scanResult) {
    result.bluetoothDeviceName =
        sha1.convert(utf8.encode(result.bluetoothDeviceName)).toString();
    result.advertisementName =
        sha1.convert(utf8.encode(result.advertisementName)).toString();
  }
  return bt;
}