1function getBrowserFingerprint() { 2 let fingerprint = ""; 3 4 fingerprint += navigator.userAgent; 5 fingerprint += `${window.screen.width}x${window.screen.height}`; 6 fingerprint += String(new Date().getTimezoneOffset()); 7 8 const fonts = ["Arial", "Helvetica", "Times New Roman"]; 9 for (let i = 0; i < fonts.length; i++) { 10 const font = fonts[i]; 11 if ((document.documentElement.style.fontFamily || "").indexOf(font) !== -1) { 12 fingerprint += font; 13 } 14 } 15 16 for (let i = 0; i < navigator.plugins.length; i++) { 17 fingerprint += navigator.plugins[i].name; 18 } 19 20 try { 21 const canvas = document.createElement("canvas"); 22 const ctx = canvas.getContext("2d"); 23 const txt = "Browser Fingerprint"; 24 25 ctx.textBaseline = "top"; 26 ctx.font = "14px 'Arial'"; 27 ctx.textBaseline = "alphabetic"; 28 ctx.fillStyle = "#f60"; 29 ctx.fillRect(125, 1, 62, 20); 30 ctx.fillStyle = "#069"; 31 ctx.fillText(txt, 2, 15); 32 ctx.fillStyle = "rgba(102, 204, 0, 0.7)"; 33 ctx.fillText(txt, 4, 17); 34 35 const dataUrl = canvas.toDataURL(); 36 fingerprint += dataUrl; 37 } catch (e) { 38 // ignore 39 } 40 41 let hash = 0; 42 if (fingerprint.length === 0) return hash; 43 44 for (let i = 0; i < fingerprint.length; i++) { 45 const char = fingerprint.charCodeAt(i); 46 hash = (hash << 5) - hash + char; 47 hash |= 0; // force 32-bit 48 } 49 50 return hash; 51}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.