From 00fd2d6d85469a899305c4807f6a46940293ca59 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Sun, 28 Mar 2021 11:36:41 +0100 Subject: [PATCH] Add in expensive audio fingerprint lookup --- .../fingerprinting/helpers/tests.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/privacy-protections/fingerprinting/helpers/tests.js b/privacy-protections/fingerprinting/helpers/tests.js index 7a7144c..70f5786 100644 --- a/privacy-protections/fingerprinting/helpers/tests.js +++ b/privacy-protections/fingerprinting/helpers/tests.js @@ -1005,6 +1005,25 @@ const tests = [ return fingerprint; } }, + { + id: 'audio', + category: 'full-fingerprint-expensive', + getValue: async () => { + // eslint-disable-next-line new-cap + const context = window.OfflineAudioContext ? new OfflineAudioContext(1, 44100, 44100) : new webkitOfflineAudioContext(1, 44100, 44100); + const renderedBuffer = await applyFpExampleDataToAudio(context); + + const vals = []; + for (var i = 0; i < renderedBuffer.length; i++) { + vals.push(renderedBuffer.getChannelData(0)[i].toString()); + } + + const fingerprint = vals + .reduce(function (acc, val) { return acc + Math.abs(val); }, 0) + .toString(); + return fingerprint; + } + }, { id: 'audio-copyFromChannel', category: 'full-fingerprints',