News for hackers. Stuff that matters.
Re:PuTTY vulnerability vuln-p521-bias by aidenn0 on Monday April 15, 2024 @05:40PM (#40045964)
Neither 15 nor 13 are powers of two.
Re:PuTTY vulnerability vuln-p521-bias by some_furry on Monday April 15, 2024 @06:04PM (#40046232)
The interval [0, 15] represent 16 possible values, which is a power of 2.

The correct way to get an unbiased distribution from a sample of 2^x to a modulo that is not an even power of 2 is to use rejection sampling.

This is what RFC 6979 says to do https://datatracker.ietf.org/doc/html/rfc6979#section-3.2

But you can also see this technique in CSPRNG code; i.e. https://github.com/php/php-src/blob/d40726670fd2915dcd807673...

Re:PuTTY vulnerability vuln-p521-bias by aidenn0 on Monday April 15, 2024 @06:11PM (#40046281)
I missed it was [0,15]

This doesn't make 13 a power of two. I'm aware of rejection sampling; my point was if you have a N bit value X and want M bits, truncating X to M bits and X MOD 2*M is the same. Neither solve the problem where M > N, which is what TFA is about.

Re:PuTTY vulnerability vuln-p521-bias by some_furry on Monday April 15, 2024 @06:15PM (#40046316)
> This doesn't make 13 a power of two.

Where did I imply that it is?

> I'm aware of rejection sampling; my point was if you have a N bit value X and want M bits, truncating X to M bits and X MOD 2*M is the same.

Sure.

> Neither solve the problem where M > N, which is what TFA is about.

If you observe my other comments, you'll see I'm well aware of what the article is about.

Re:PuTTY vulnerability vuln-p521-bias by aidenn0 on Monday April 15, 2024 @06:23PM (#40046391)
> Where did I imply that it is?

You used 13 as an example in a response to my comment that was:

Isn't modulo the same as truncation when dealing with powers of two?

Re:PuTTY vulnerability vuln-p521-bias by some_furry on Monday April 15, 2024 @06:57PM (#40046623)
> You used 13 as an example

I don't see the number 13 in any of my comments on this thread (except this one, or where I quoted you). Perhaps you are confusing me with someone else?

Re:PuTTY vulnerability vuln-p521-bias by aidenn0 on Monday April 15, 2024 @07:32PM (#40046836)
Ah yes, that was lambdafu
Re:PuTTY vulnerability vuln-p521-bias by wbl on Monday April 15, 2024 @06:01PM (#40046195)
But 16 is.