-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SHA256 hash selection algorithm for AXE
Daniel Raeder edited this page May 14, 2022
·
4 revisions
Example code for Node. Will need to be adapted for browser support.
const crypto = require('crypto')
import SEA from 'gun/sea/sea.js'
let data = []
let data1 = await SEA.work('mark/name', null, null, {name: "SHA-256", encode: 'hex'})
let data2 = await SEA.work('mark/phone', null, null, {name: "SHA-256", encode: 'hex'})
let data3 = await SEA.work('mark/age', null, null, {name: "SHA-256", encode: 'hex'})
data.push(data1, data2, data3)
console.log(data)
let closest = data.reduce((min, c) => c < min? c : min)
let furthest = data.reduce((max, c) => c > max? c : max)
console.log('closest', closest, 'furthest', furthest)