Sujet : Re: lun - Lucky Number
De : 333200007110-0201 (at) *nospam* ybtra.de (Marcel Logen)
Groupes : sci.cryptDate : 08. Mar 2025, 23:34:33
Autres entêtes
Organisation : Bureau Logen
Message-ID : <20250308sa223433@o15.ybtra.de>
References : 1 2 3 4
User-Agent : geLogen/28 (ZmxuZXdzLzEuMy4wcHJlMjggKGZvciBHTlUvTGludXgp)
Rich in sci.crypt:
Ok, here's a simple random number generator using /dev/urandom:
>
#!/usr/bin/tclsh
>
set fd [open /dev/urandom {RDONLY BINARY}]
binary scan [read $fd 16] ww hi lo
close $fd
>
puts "Your 128-bit random number is: [expr {abs($hi)*2^64 + abs($lo)}]"
Interesting. But what is "ww"?
16 * 8 = 128 -> OK, but ...:
Four sample runs:
>
~$ ./random.tcl
Your 128-bit random number is: 12845925169244013330
~$ ./random.tcl
Your 128-bit random number is: 12267131317558982811
~$ ./random.tcl
Your 128-bit random number is: 10434877321040400260
~$ ./random.tcl
Your 128-bit random number is: 16618556391581443091
^^^
64 (?)
| $ echo 'l(16618556391581443091)/l(2)' | bc -l
| 63.84942886744934185453
But I'm not entirely sure if I'm on the right track.
Marcel (Lines: 40)
-- ╭───╮ ╭──╮ ╭────╮ ╭─╮ ╭───╮ ..56..╭────╮ ╮ ╰─╮ ╰────╮ ╭──╮ ╭──╯ │ │ ╭─╯ │ ╰─╯ ╰────╮ ╭───╮ ╰─╮ ╰─╮ │ ╰────╮ │ │ ╰───╯ ╰─╯ ╰─╮ ╰───╮ ╭─────╯ │ ╰──╮ ╰─╮ ╰─╮ ╰─────────╯ ╰──╯ ╰──────╯ ╰───────╯..55..╰────╯ ╰─