You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We really should swap out for a "real" CSPRNG, not because it'll be more secure, but because it'll be way faster than deriving a new HD key and hashing it. Preferrably something chacha-based given we already have chacha in-tree.
I've done an initial experiment, and it seems that using chacha can get the execution time of get_secure_random_bytes from ~235 ns down to just ~4 ns on my machine.
Some of the tests broke, but I think it's due to them relying on the values that the original method generated using the same starting_time_nanos and starting_time_secs. Looking into it.
I think I need some help here. I opened a draft PR with the current state of my attempt -> #1974.
One unit test fails because 2 Outpoints are equal when they should be different. I'm not sure if this shows a problem with the get_secure_random_bytes() method or if it's something that must be changed in the tests. I've already spent some time trying to figure it out but to no avail...
Also, I'm not sure of the safety of the RNG implementation. Some thoughts on that would also be appreciated 🙂
Activity
danielgranhao commentedon Jan 17, 2023
I can take this up if no one has started yet.
I've done an initial experiment, and it seems that using chacha can get the execution time of
get_secure_random_bytesfrom ~235 ns down to just ~4 ns on my machine.Some of the tests broke, but I think it's due to them relying on the values that the original method generated using the same
starting_time_nanosandstarting_time_secs. Looking into it.TheBlueMatt commentedon Jan 17, 2023
Nice! Thanks.
danielgranhao commentedon Jan 20, 2023
I think I need some help here. I opened a draft PR with the current state of my attempt -> #1974.
One unit test fails because 2
Outpointsare equal when they should be different. I'm not sure if this shows a problem with theget_secure_random_bytes()method or if it's something that must be changed in the tests. I've already spent some time trying to figure it out but to no avail...Also, I'm not sure of the safety of the RNG implementation. Some thoughts on that would also be appreciated 🙂
TheBlueMatt commentedon Jan 25, 2023
Let's continue the discussion on the PR, thanks!