; Puedo-Random Number Generator ; Interface: ; ; ; EAX is used to initialize PRNG_CA_Pasqualoni_State. This allows a quick ; repeatable way to establish a possition within the PRNG stream. If the ; state array is not manually configured this function should be executed ; prior to PRNG use. PRNG_CA_Pasqualoni_Seed PROTO STDCALL iSeed:DWORD ; When all the data in PRNG_CA_Pasqualoni_State has been used this function ; will itterate through use of a ; The celluar automata defined within the PRNG opperates on the state space ; when this function is called. PRNG_CA_Pasqualoni_Renew PROTO STDCALL ;PRNG_CA_Pasqualoni_DWORD PROTO STDCALL ; complete state of PRNG EXTERNDEF SYSCALL PRNG_CA_Pasqualoni_State:BYTE ; must be a multiple of 4 for this implementation PRNG_CA_Pasqualoni_StateWidth EQU 2056
; this macro streamlines use by accessing state array directly ; at the cost of a register to store index in array. ; ; mov ebp, PRNG_CA_Pasqualoni_StateWidth / 4 ;_0: PRNG_CA_Pasqualoni eax, ebp ; (do somthing with random data) ; jmp _0 ; arguments are registers, branch is correctly predicted ; this can be modified to support bits/bytes/words/dword/etc... PRNG_CA_Pasqualoni MACRO reg:REQ, indx:REQ LOCAL _0 ; note: bytes before array are read mov reg, DWORD PTR [PRNG_CA_Pasqualoni_State][indx*4][-4] dec indx jne _0 call PRNG_CA_Pasqualoni_Renew mov indx, PRNG_CA_Pasqualoni_StateWidth / 4 _0: ENDM