UNPKG

bitwebyespower

Version:

YesPower and Yescryptr16 for Bitweb

25 lines (20 loc) 2.11 kB
const yespower = require("../lib/binding.js"); const assert = require("assert"); assert(yespower, "The expected function is undefined"); function testYespower() { var data = new Buffer.from("010000000000000000000000000000000000000000000000000000000000000000000000e0aac344bf218bbb5eee3d1d5ca00757a786598583781c60c55e8ff03033360474ce8e60ffff1f1f8b0200000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2e04ffff001d010426626974776562332e30203d204254452d2d796573706f7765722d2d2d323032312f30352f3033ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000", "hex"); const result = yespower(data); console.log(result.toString("hex")); assert.deepEqual(result, new Buffer.from("f3f162be69a8f22b5a484ef8d75d43dab9a7837a76c366d29b4dc56b9c3e0400","hex"), "Unexpected value returned"); } function testYescryptR16() { var data = new Buffer.from("0000002056cf28d47455aaf6da77b5b73fe82e0721aa9bb415e82192c56572fd7d000000826680c7299d92f621c0f2ae28286f8e3dbd3eec3f9cf52b3251142f3d4a7ff3fc7af9630f94001e0000d5f401010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4e0374790e04fc7af96308fabe6d6d000000000000000000000000000000000000000000000000000000000000000001000000000000007286e803000000000f706f6f6c2e72706c616e742e78797a00000000020000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900f90295000000001976a9142d8c740dfee1fbfb4830e54e7875a772d872cfbe88ac0120000000000000000000000000000000000000000000000000000000000000000000000000", "hex"); const result = yespower(data); console.log(result.toString("hex")); assert.deepEqual(result, new Buffer.from("2107ac714a6767bb97effa590ffc989b3795575ccbc9ca3371d3e1d069000000","hex"), "Unexpected value returned"); } assert.doesNotThrow(testYespower, undefined, "testBasic threw an expection"); assert.doesNotThrow(testYescryptR16, undefined, "testBasic threw an expection"); console.log("Tests passed- everything looks OK!");