Files and random numbers¶
Text and binary files¶
Files opened without b in the fopen mode, or without O_BINARY, are
text files: line ends are CR LF on disk and Ctrl-Z ends the file. See
libos/msdos/README.md in picolibc.
Random numbers¶
arc4random is seeded by getentropy, which has no random source on DOS
or Windows to read: it mixes the clocks, the stack and many readings of
the 8253 timer, with RDTSC when the CPU has it, through the ChaCha
permutation. The seed is different on each run; on a CPU with RDTSC it
is hard to guess, but on an 8088 PC it comes mostly from the time the
program started, so it is no good for keys there.