Created
October 30, 2020 08:59
-
-
Save arzzen/d985afe599901183c232c88afb421afa to your computer and use it in GitHub Desktop.
simple javascript fingerprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fingerprint = (function(window, screen, navigator) { | |
function checksum(str) { | |
var hash = 5381, | |
i = str.length; | |
while (i--) hash = (hash * 33) ^ str.charCodeAt(i); | |
return hash >>> 0; | |
} | |
function map(arr, fn){ | |
var i = 0, len = arr.length, ret = []; | |
while(i < len){ | |
ret[i] = fn(arr[i++]); | |
} | |
return ret; | |
} | |
return checksum([ | |
navigator.userAgent, | |
[screen.height, screen.width, screen.colorDepth].join('x'), | |
new Date().getTimezoneOffset(), | |
!!window.sessionStorage, | |
!!window.localStorage, | |
map(navigator.plugins, function (plugin) { | |
return [ | |
plugin.name, | |
plugin.description, | |
map(plugin, function (mime) { | |
return [mime.type, mime.suffixes].join('~'); | |
}).join(',') | |
].join("::"); | |
}).join(';') | |
].join('###')); | |
}(this, screen, navigator)); | |
document.body.innerHTML = fingerprint; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment