bitcoinjs/bitcoinjs-lib — pull request #19 by shesek (2013-11-27 05:01:05+00:00)
Title: Some RNG improvments

- Seed jsbn's PRNG with a CSPRNG when available
- Use `H(message||privkey||random)` for picking K for signatures

Using `H(message||privkey||random)` ensures that K is always unique (since its based on the transaction hash) and that it contains data that is hard for an attacker to guess (since it contains the private key). This is the recommend way to generate K values, and is how bitcoin-qt does that. The random data is not really necessary, but can't really hurt either.