Skip to content

Commit

Permalink
Add in expensive audio fingerprint lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston committed Mar 29, 2021
1 parent d58005d commit c904a93
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions privacy-protections/fingerprinting/helpers/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (let 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',
Expand Down

0 comments on commit c904a93

Please sign in to comment.