Generating RSA pairs
Peter M. Brigham
pmbrig at gmail.com
Sun May 5 09:23:09 EDT 2013
On May 2, 2013, at 7:08 PM, Igor de Oliveira Couto wrote:
> There are a few well-documented ways to gather usable, unique seeds, such as:
>
> * getting the user to type for 10-20 seconds, randomly picking chars entered (PGP used this technique when initially generating the keys for the user)
> * getting the user to move the cursor on the screen and randomly recording mouse coordinates
> * parsing time-based readings - ie., getting 'the millisecons', then combining it with 'the internet time', then picking a few of the characters randomly from the resulting string
> * asking the user to select 2 or 3 files in their system, and reading random bits from the files
Just wading through my email, so the conversation has already moved on, but for anyone interested, here's a somewhat "more random" random number generator:
function rRandom n
-- returns a (more random) random number between 1 and n
-- works for n up to ~ 4.29 billion
put the long seconds into ss
-- returns 6 digits after the decimal, ie, down to microseconds
-- use the fractional part only:
if "." is not in ss then
-- very unlikely to hit it exactly on the full second, but just to be sure
put 0 into ss
else
delete char 1 to offset(".",ss) of ss -- 6 digits, maybe less
end if
set the randomseed to ss + random(1000000) + 1000
return (random(4294967295) mod n) + 1
-- 4294967295 (= 2^32 - 1) is the largest argument permissible for random()
end rRandom
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list