Page 1 of 1

Example from crafted pseudorandom output.

Posted: Sun Apr 24, 2011 2:12 pm
by Azul
Random() - Help files wrote:This command uses a pseudorandom number generator which is very fast and produces randomly looking output..

Code: Select all

Define string.s
Define temp.s

string = "iUhJypOdEbiOkTqmnPkDokIjYgDsKyOzxvtRfgjrigUguygiuYguyguYDdeeQuoonbhjJazsEzeZtretrERfyutiuygUygD"
string + "rsWBoiIUuigIUGTYDtcoinuOIoinuTfyttectytrciUyrctrecYTretreCtIuTTeiuBIuyIuyboiuybPOIUOiunOIybuytv"
string + "TRCYtYTvuytvuytUyRCExTerytvrUIytytviUTcrYTectretrxeRcytrcYtrcyTrCrWzxXxtrEcyTrvUytbUIybuiybiuyb"
string + "iutvcEEWrextrXrexctrvgunhiuoniuybviliUYTuytvuyTvuYTUVyrytexCTvbyuinopUIVtcytrCytrctyrvbiuonyioU"
string + "YVYRCtycrvbuyiuBYiuysiouOiuoIuviuvUytvuitycuytcTYercYtrvbuyiutyctrextreXTrcvtyrVytrcYtrCtyrcytc"
string + "rtycrYtrCYTrctyRcYTrxeEwxtrectyrcyTr"

RandomSeed(512)

For a=1 To 9
  temp+Mid(string,Random(512),1)
Next

Debug temp
"String" is not so random since I created it manually but hiding long strings into huge RandomData() dump is one way to hide text. Got idea from quite old trick to search words from common book to solve secret message.

Re: Example from crafted pseudorandom output.

Posted: Sun Apr 24, 2011 3:03 pm
by Demivec
Neat idea.

Here's a simple variation of my own:

Code: Select all

Define.s msg = "YvpmGbfye", temp
RandomSeed(512)

For a = 1 To Len(msg)
  temp + Chr(Asc(Mid(msg, a, 1)) ! Random(26))
Next

Debug temp

Re: Example from crafted pseudorandom output.

Posted: Sun Apr 24, 2011 5:12 pm
by Rook Zimbabwe
from the PB 4.51 docs:
NOT MY CODE

Code: Select all

  *Key = AllocateMemory(16)    If OpenCryptRandom() And *Key
    CryptRandomData(*Key, 16)        Text$ = "Generated Key:"    For i = 0 To 15
      Text$ + " " + RSet(Hex(PeekB(*Key+i), #PB_Byte), 2, "0")    Next i     
        CloseCryptRandom()  Else    Text$ = "Key generation is not available"
  EndIf    MessageRequester("Example", Text$)
Don't forget about CryptRandom() and CryptRandomData() :mrgreen: