|
|
@ -18,17 +18,14 @@ module.exports = function namehash (inputName) {
|
|
|
|
const name = normalize(inputName)
|
|
|
|
const name = normalize(inputName)
|
|
|
|
const split = name.split('.')
|
|
|
|
const split = name.split('.')
|
|
|
|
|
|
|
|
|
|
|
|
const label = toBuffer(split.shift())
|
|
|
|
const label = split.shift()
|
|
|
|
const remainder = toBuffer(split.join('.'))
|
|
|
|
const remainder = split.join('.')
|
|
|
|
|
|
|
|
|
|
|
|
console.log('finishing with ', typeof sha3(label))
|
|
|
|
console.log('finishing with ', typeof sha3(label))
|
|
|
|
|
|
|
|
|
|
|
|
console.log(sha3(label))
|
|
|
|
console.log(sha3(label))
|
|
|
|
|
|
|
|
|
|
|
|
const result = sha3(namehash(remainder) + sha3(label))
|
|
|
|
return sha3(namehash(remainder) + sha3(label))
|
|
|
|
console.dir(result)
|
|
|
|
|
|
|
|
throw new Error('stop')
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -40,7 +37,3 @@ function sha3 (input) {
|
|
|
|
function normalize(name) {
|
|
|
|
function normalize(name) {
|
|
|
|
return uts46.toUnicode(name, {useStd3ASCII: true, transitional: false});
|
|
|
|
return uts46.toUnicode(name, {useStd3ASCII: true, transitional: false});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function toBuffer(str) {
|
|
|
|
|
|
|
|
return new Buffer(str, 'utf8')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|