Fingerprintjs2:一款开源设备指纹采集器

作者: JONE 分类: PHPer 发布时间: 2019-06-25 23:26

文章原文:https://www.jianshu.com/p/7e8499655f9a

更多使用介绍:http://www.freebuf.com/sectool/105353.html

GitHub项目地址:https://github.com/Valve/fingerprintjs2

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.5.1/fingerprint2.min.js"></script>

<script>

    new Fingerprint2().get(function(result, components){
        alert(result);
        console.log(result); //a hash, representing your device fingerprint
        console.log(components); // an array of FP components
    });

</script>
调用方法

var fingerprint = new Fingerprint().get();
如果你想使用 Canvas FingerPrinting,则如下调用:

var fingerprint = new Fingerprint({canvas: true}).get();
如果你想使用屏幕分辨率计算指纹,则需如下调用:

var fingerprint = new Fingerprint({screen_resolution: true}).get();
使用自定义的哈希函数

var my_hasher = new function(value, seed){ return value.length % seed; };
var fingerprint = new Fingerprint({hasher: my_hasher}).get();
或者直接传递方法:

var my_hasher = new function(value, seed){ return value.length % seed; };
var fingerprint = new Fingerprint(my_hasher).get();