Files
libguestfs/builder
Török Edwin 6a1061663f Avoid modulo bias in random password generation
Char.code (input_char chan) mod nr_chars has modulo bias because
the original interval is not a multiple of the destination interval,
i.e. 256 mod nr_chars != 0.

One way to fix this is to keep generating random numbers until they fall outside
the interval where modulo bias occurs, that is accept only c=[256 % nr_chars, 256).
That interval maps back to [0, nr_chars), and has a length of
(256 - 256 % nr_chars), which is a multiple of nr_chars.

RWMJ:
 - Modify the code so it goes into a utility library.
 - Use the same code across virt-builder and virt-sysprep.
2013-11-14 10:52:16 +00:00
..
2013-10-12 21:34:23 +01:00
2013-10-12 21:34:23 +01:00
2013-10-03 22:02:44 +01:00