Created
July 22, 2014 14:07
-
-
Save julescarbon/0994145ab15380d2f80d to your computer and use it in GitHub Desktop.
i.ligatus.com/script/fingerprint.min.js canvas fingerprinter unminified
This file contains 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
! function (t) { | |
"use strict"; | |
var e = function (t) { | |
var e, n; | |
e = Array.prototype.forEach | |
n = Array.prototype.map | |
this.each = function (t, n, r) { | |
if (null !== t) | |
if (e && t.forEach === e) t.forEach(n, r); | |
else if (t.length === +t.length) { | |
for (var i = 0, a = t.length; a > i; i++) | |
if (n.call(r, t[i], i, t) === {}) return | |
} else | |
for (var o in t) | |
if (t.hasOwnProperty(o) && n.call(r, t[o], o, t) === {}) return | |
} | |
this.map = function (t, e, r) { | |
var i = []; | |
return null == t ? i : n && t.map === n ? t.map(e, r) : (this.each(t, function (t, n, a) { | |
i[i.length] = e.call(r, t, n, a) | |
}), i) | |
} | |
if ("object" == typeof t) { | |
this.hasher = t.hasher | |
this.screen_resolution = t.screen_resolution | |
this.canvas = t.canvas | |
this.ie_activex = t.ie_activex | |
} | |
else if ("function" == typeof t) { | |
this.hasher = t | |
} | |
}; | |
e.prototype = { | |
get: function () { | |
var t = []; | |
if (t.push(navigator.userAgent), t.push(navigator.language), t.push(screen.colorDepth), this.screen_resolution) { | |
var e = this.getScreenResolution(); | |
"undefined" != typeof e && t.push(this.getScreenResolution().join("x")) | |
} | |
t.push((new Date).getTimezoneOffset()) | |
t.push(this.hasSessionStorage()) | |
t.push(this.hasLocalStorage()) | |
t.push(!!window.indexedDB) | |
t.push(typeof document.body.addBehavior) | |
t.push(typeof window.openDatabase) | |
t.push(navigator.cpuClass) | |
t.push(navigator.platform) | |
t.push(navigator.doNotTrack) | |
t.push(this.getPluginsString()) | |
this.canvas && this.isCanvasSupported() && t.push(this.getCanvasFingerprint()) | |
return this.hasher ? this.hasher(t.join("###"), 31) : this.murmurhash3_32_gc(t.join("###"), 31) | |
}, | |
murmurhash3_32_gc: function (t, e) { | |
var n, r, i, a, o, s, c, h; | |
for (n = 3 & t.length, r = t.length - n, i = e, o = 3432918353, s = 461845907, h = 0; r > h;) c = 255 & t.charCodeAt(h) | (255 & t.charCodeAt(++h)) << 8 | (255 & t.charCodeAt(++h)) << 16 | (255 & t.charCodeAt(++h)) << 24, ++h, c = 4294967295 & (65535 & c) * o + ((65535 & (c >>> 16) * o) << 16), c = c << 15 | c >>> 17, c = 4294967295 & (65535 & c) * s + ((65535 & (c >>> 16) * s) << 16), i ^= c, i = i << 13 | i >>> 19, a = 4294967295 & 5 * (65535 & i) + ((65535 & 5 * (i >>> 16)) << 16), i = (65535 & a) + 27492 + ((65535 & (a >>> 16) + 58964) << 16); | |
switch (c = 0, n) { | |
case 3: | |
c ^= (255 & t.charCodeAt(h + 2)) << 16; | |
case 2: | |
c ^= (255 & t.charCodeAt(h + 1)) << 8; | |
case 1: | |
c ^= 255 & t.charCodeAt(h), c = 4294967295 & (65535 & c) * o + ((65535 & (c >>> 16) * o) << 16), c = c << 15 | c >>> 17, c = 4294967295 & (65535 & c) * s + ((65535 & (c >>> 16) * s) << 16), i ^= c | |
} | |
return i ^= t.length, i ^= i >>> 16, i = 4294967295 & 2246822507 * (65535 & i) + ((65535 & 2246822507 * (i >>> 16)) << 16), i ^= i >>> 13, i = 4294967295 & 3266489909 * (65535 & i) + ((65535 & 3266489909 * (i >>> 16)) << 16), i ^= i >>> 16, i >>> 0 | |
}, | |
hasLocalStorage: function () { | |
try { | |
return !!t.localStorage | |
} catch (e) { | |
return !0 | |
} | |
}, | |
hasSessionStorage: function () { | |
try { | |
return !!t.sessionStorage | |
} catch (e) { | |
return !0 | |
} | |
}, | |
isCanvasSupported: function () { | |
var t = document.createElement("canvas"); | |
return !(!t.getContext || !t.getContext("2d")) | |
}, | |
isIE: function () { | |
return "Microsoft Internet Explorer" === navigator.appName ? !0 : "Netscape" === navigator.appName && /Trident/.test(navigator.userAgent) ? !0 : !1 | |
}, | |
getPluginsString: function () { | |
return this.isIE() ? this.getIEPluginsString() : this.getRegularPluginsString() | |
}, | |
getRegularPluginsString: function () { | |
return this.map(navigator.plugins, function (t) { | |
var e = this.map(t, function (t) { | |
return [t.type, t.suffixes].join("~") | |
}).join(","); | |
return [t.name, t.description, e].join("::") | |
}, this).join(";") | |
}, | |
getIEPluginsString: function () { | |
var e = ["ShockwaveFlash.ShockwaveFlash", | |
"AcroPDF.PDF", | |
"PDF.PdfCtrl", | |
"QuickTime.QuickTime", | |
"rmocx.RealPlayer G2 Control", | |
"rmocx.RealPlayer G2 Control.1", | |
"RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)", | |
"RealVideo.RealVideo(tm) ActiveX Control (32-bit)", | |
"RealPlayer", | |
"SWCtl.SWCtl", | |
"WMPlayer.OCX", | |
"AgControl.AgControl", | |
"Skype.Detection"]; | |
return this.ie_activex && t.ActiveXObject ? this.map(e, function (t) { | |
try { | |
return new ActiveXObject(t), t | |
} catch (e) { | |
return null | |
} | |
}).join(";") : "" | |
}, | |
getScreenResolution: function () { | |
return [screen.height, screen.width] | |
}, | |
getCanvasFingerprint: function () { | |
var t = document.createElement("canvas"), | |
e = t.getContext("2d"), | |
n = "http://valve.github.io"; | |
e.textBaseline = "top" | |
e.font = "14px 'Arial'" | |
e.textBaseline = "alphabetic" | |
e.fillStyle = "#f60" | |
e.fillRect(125, 1, 62, 20) | |
e.fillStyle = "#069" | |
e.fillText(n, 2, 15) | |
e.fillStyle = "rgba(102, 204, 0, 0.7)" | |
e.fillText(n, 4, 17) | |
return t.toDataURL() | |
} | |
}, "object" == typeof module && "object" == typeof exports && (module.exports = e), t.Fingerprint = e | |
}(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment