bitcoin-core / secp256k1

Optimized C library for EC operations on curve secp256k1
MIT License
2.06k stars 1k forks source link

Examples should not retry on bad randomness keys in a loop #1570

Open real-or-random opened 2 months ago

real-or-random commented 2 months ago

Well, we should change the other examples and perhaps also the API docs. Creating keys in a while loop is not good practice. If you hit an invalid key, you're most probably not very lucky, but very unlucky because your randomness is broken. But hey, yeah, let's just yolo and try again. :)

_Originally posted by @real-or-random in https://github.com/bitcoin-core/secp256k1/pull/1519#discussion_r1675553262_