xcoder
Member in Training
Posts: 56
|
Post by xcoder on Oct 27, 2022 8:42:51 GMT
print "#######################"
seed = 0.12345
x = 2^ 40
print ""
randomize seed
for i = 1 to 30
rand = int(rnd(1) * x)
hex$ = decHex$(rand)
print hex$
next i
print ""
print "The total number of 8 byte keys are "; 2^40
print" More that 1 trillion and 99 billion"
End
|
|
atomose
Member in Training
Posts: 41
|
Post by atomose on Oct 27, 2022 9:23:11 GMT
Hello ! if we want to use these keys on a program (for example when opening the program to protect it) how do you know if the key given to the person is indeed one of the generated keys? thx
|
|
xcoder
Member in Training
Posts: 56
|
Post by xcoder on Oct 28, 2022 5:49:04 GMT
print "#######################"
seed = 0.12345
x = 2^ 40
print ""
randomize seed
for i = 1 to 30
rand = int(rnd(1) * x)
hex$ = decHex$(rand)
print i, hex$
next i
print ""
print "The total number of 8 byte keys are "; 2^40
print" More that 1 trillion and 99 billion"
End
|
|
|
Post by tsh73 on Oct 28, 2022 7:14:04 GMT
|
|
xcoder
Member in Training
Posts: 56
|
Post by xcoder on Nov 1, 2022 19:05:25 GMT
Hello ! if we want to use these keys on a program (for example when opening the program to protect it) how do you know if the key given to the person is indeed one of the generated keys? thx count = 0 for i = 1 to 10 count = count + 1 print count; " the key" next i Correction: the code generates keys of 5 bytes (40 bits), not 8 bytes.
|
|
xcoder
Member in Training
Posts: 56
|
Post by xcoder on Nov 5, 2022 23:25:15 GMT
There is a flaw in the posted code. The function "decHex" will not produce two hex characters for decimal number 0 to 15. The following code will correct that problem. It's got to be JB governor!
print "#################"
dim K(20)
call keyGen
End
sub keyGen
seed = 0.12345
randomize seed
for i = 0 to 20
rand = int(rnd(1) * 256) ''2^32)
hex$ = decHex$(rand)
fHex$ = right$("0" + hex$,2)
K(i) = rand
print K(i), fHex$
next i
end sub
|
|