urbit-ob

JavaScript utilities for phonemic base wrangling.
Log | Files | Refs | README

commit cc32174f7226a7377a7a16025487316f735c4229
parent 475bd441aa2778795e4c51276805edce245cfb40
Author: Jared Tobin <jared@jtobin.io>
Date:   Thu, 14 Mar 2019 16:08:18 +1300

Use the old algorithm's seeds.

.. we want to preserve @p's, after all.

Diffstat:
Msrc/internal/ob.js | 11+----------
Mtest/ob.test.js | 16++++++++--------
2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/internal/ob.js b/src/internal/ob.js @@ -14,14 +14,6 @@ const ux_ffff_ffff_0000_0000 = new BN('ffffffff00000000', 'hex') const u_65535 = new BN('65535') const u_65536 = new BN('65536') -// PRF seeds -const rako = [ - 0x4b387af7, - 0x85bcae01, - 0xee281300, - 0xb76d5eed, -] - // old PRF seeds const raku = [ 0xb76d5eed, @@ -32,7 +24,7 @@ const raku = [ // a PRF for j in { 0, .., 3 } const F = (j, arg) => - muk(rako[j], 2, arg) + muk(raku[j], 2, arg) /** * Conceal structure v3. @@ -312,7 +304,6 @@ module.exports = { F, raku, - rako, fe, Fe, diff --git a/test/ob.test.js b/test/ob.test.js @@ -65,20 +65,20 @@ describe('fein/fynd', () => { it('fein matches expected reference values', () => { let input = new BN('123456789') - let output = new BN('4133907371') + let output = new BN('1897766331') expect(fein(input).eq(output)).to.equal(true) input = new BN('15663360') - output = new BN('3867563781') + output = new BN('1208402137') expect(fein(input).eq(output)).to.equal(true) }) it('fynd matches expected reference values', () => { - let input = new BN('4133907371') + let input = new BN('1897766331') let output = new BN('123456789') expect(fynd(input).eq(output)).to.equal(true) - input = new BN('3867563781') + input = new BN('1208402137') output = new BN('15663360') expect(fynd(input).eq(output)).to.equal(true) }) @@ -124,20 +124,20 @@ describe('feis/tail', () => { it('feis matches expected reference values', () => { let input = new BN ('123456789') - let output = new BN('4076532648') + let output = new BN('2060458291') expect(feis(input).eq(output)).to.equal(true) input = new BN('15663360') - output = new BN('2239503936') + output = new BN('1195593620') expect(feis(input).eq(output)).to.equal(true) }) it('tail matches expected reference values', () => { - let input = new BN('4076532648') + let input = new BN('2060458291') let output = new BN ('123456789') expect(tail(input).eq(output)).to.equal(true) - input = new BN('2239503936') + input = new BN('1195593620') output = new BN('15663360') expect(tail(input).eq(output)).to.equal(true) })