From df41d19f26644a7bebf4974ade1e9b1996a2eea8 Mon Sep 17 00:00:00 2001 From: randogoth Date: Mon, 22 May 2023 01:08:26 +0300 Subject: [PATCH] simplified --- web/nfc-theme/static/geo.js | 69 ------------------------------------- 1 file changed, 69 deletions(-) diff --git a/web/nfc-theme/static/geo.js b/web/nfc-theme/static/geo.js index e450269..c0310cb 100644 --- a/web/nfc-theme/static/geo.js +++ b/web/nfc-theme/static/geo.js @@ -21,75 +21,6 @@ if ( hasharray.length > 0 ) { // fingerprint user -function cyrb53(str, seed = 0){ - let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; - for (let i = 0, ch; i < str.length; i++) { - ch = str.charCodeAt(i); - h1 = Math.imul(h1 ^ ch, 2654435761); - h2 = Math.imul(h2 ^ ch, 1597334677); - } - h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909); - h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909); - return 4294967296 * (2097151 & h2) + (h1 >>> 0); -}; - -function audioFingerprint() { - const AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContex; - const context = new AudioContext(1, 5000, 44100); - const oscillator = context.createOscillator(); - oscillator.type = "triangle"; - oscillator.frequency.value = 1000; - const compressor = context.createDynamicsCompressor() - compressor.threshold.value = -50; - compressor.knee.value = 40; - compressor.ratio.value = 12; - compressor.reduction.value = 20; - compressor.attack.value = 0; - compressor.release.value = 0.2; - oscillator.connect(compressor); - compressor.connect(context.destination); - oscillator.start() - context.oncomplete = event => { - const samples = event.renderedBuffer.getChannelData(0); - let hash = 0; - for (let i = 0; i < samples.length; ++i) { - hash += Math.abs(samples[i]); - } - return hash; - }; - context.startRendering(); -} - -function canvasFingerprint() { - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - var txt = 'Numinous Field Communication'; - ctx.textBaseline = "top"; - ctx.font = "14px 'Arial'"; - ctx.textBaseline = "alphabetic"; - ctx.fillStyle = "#f60"; - ctx.fillRect(125, 1, 62, 20); - ctx.fillStyle = "#069"; - ctx.fillText(txt, 2, 15); - ctx.fillStyle = "rgba(102, 204, 0, 0.7)"; - ctx.fillText(txt, 4, 17); - src = canvas.toDataURL(); - var hash; - for (i = 0; i < src.length; i++) { - char = src.charCodeAt(i); - hash = ((hash<<5)-hash)+char; - hash = hash & hash; - } - return hash; -}; - -function getFingerprint() { - const audioFp = audioFingerprint(); - const canvasFp = canvasFingerprint(); - const hash = cyrb53(audioFp + canvasFp); - return hash; -}; - const generateUUID = () => { let d = new Date().getTime(),