JSPM

ordering-encrypt

0.0.5
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q12956F
    • License MIT

    partial ordering encrypt lib

    Package Exports

    • ordering-encrypt

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ordering-encrypt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Ordering-Encrypt

    局部排序加密库

    主要有两个方法

    • function decode(data, p, b = 3, d = 3, check = false)
    • function compare(origin, target)

    用法 - Usage

    const encrypt = require('ordering-encrypt');
    
    let data = [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 10, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1]
    let p = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 10, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]
    
    // 获得加密数据
    let final = encrypt.decode(data,p)
    
    // 对比加密结果,下面的similar预期结果为1
    let similar = encrypt.compare(final,final)
    
    // 获得数据距离sum(|a_i-b_i|) i=0...n
    let distence = encrypt.getDistance(final,final)

    算法

    设计来源,学术论文

    Iris Template Protection Based on Local Ranking

    by:Dongdong Zhao, Shu Fang, Jianwen Xiang , Jing Tian, and Shengwu Xiong