iancoleman / eip2333-tool

Tool for generating bls12-381 keys using the EIP2333 standard
https://iancoleman.io/eip2333/
MIT License
20 stars 4 forks source link

Update noble-bls to improve security #3

Closed paulmillr closed 3 years ago

paulmillr commented 3 years ago

@iancoleman make sure to build it please

iancoleman commented 3 years ago

I'm in the process now, but am failing this test:

masterPrv = new Uint8Array([25, 207, 229, 88, 53, 10, 115, 205, 117, 155, 230, 16, 158, 148, 203, 202, 99, 4, 146, 214, 139, 43, 228, 28, 218, 233, 237, 186, 78, 16, 3, 80]);
childPrv = libs.blskeygen.deriveChild(masterPrv, 13);
childPrvLen = childPrv.length; // expect 32, get 31
paulmillr commented 3 years ago

@iancoleman fixing in 1 sec

paulmillr commented 3 years ago

@iancoleman fixed in bls12-381-keygen@0.1.3

iancoleman commented 3 years ago

Thanks! I'll update the package.json to the latest version.

iancoleman commented 3 years ago

I'm seeing my tests that were passing with big endian hex are now failing because it's generating little endian. Is this expected?

Looks like this line might be causing grief: https://github.com/paulmillr/bls12-381-keygen/commit/964c5443ac2c8a1b1d0e826398e58013ff9ac7c2#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R27

Specifically I'm testing for the eip2333 test cases, see https://github.com/iancoleman/eip2333-tool/blob/3af02cd16d3f65976a40eedac9280d66aafea489/tests/spec/tests.js#L157-L185

Expected '7050b4223168ae407dee804d461fc3dbfe53f5dc5218debb8fab6379d559730d' to be '0d7359d57963ab8fbbde1852dcf553fedbc31f464d80ee7d40ae683122b45070'.
paulmillr commented 3 years ago

@iancoleman sorry for my nonsense, i've copy-pasted LE function instead of BE. Fixed now.

paulmillr commented 3 years ago

bls-keygen actually has test vectors, they were failing after that change, i've pushed pkg without testing it first.