Hashes and random numbers
In the terminalela --spec hashes-and-random-numbers
| Built-in | Does |
|---|---|
hash.sha256(text) | The SHA-256 of the text as 64 lower-case hex digits, as sha256sum prints it, worked out in the process |
rand.int(a, [b]) | A whole number from 0 up to a, not a itself, or from a up to b, as range counts: rand.int(6) is 0 to 5, rand.int(1, 7) 1 to 6 |
rand.intreads the kernel's random source,getrandom(2), or in a browser page the browser's,crypto.getRandomValues, and every number in its range is as likely as the next. Ends that are not whole numbers, or a range with no number in it,rand.int(3, 3), are an error.
if hash.sha256(file.read($download)) != $want warn "$download is not the file the site lists" exit 1end ifport = rand.int(20_000, 30_000)