Example #1
0
globle void SeedFunction(
    void *theEnv)
{
    DATA_OBJECT theValue;

    /*==========================================================*/
    /* Check to see that a single integer argument is provided. */
    /*==========================================================*/

    if (EnvArgCountCheck(theEnv,"seed",EXACTLY,1) == -1) return;
    if (EnvArgTypeCheck(theEnv,"seed",1,INTEGER,&theValue) == FALSE) return;

    /*=============================================================*/
    /* Seed the random number generator with the provided integer. */
    /*=============================================================*/

    genseed((int) DOToLong(theValue));
}
Example #2
0
/*******************************generate IV**********************************/
void genIV(unsigned char* iv) {
    int i;
    genseed();
    for (i = 0; i < IVSIZE; i++)
	iv[i] = rand();
}
Example #3
0
/*******************random generate key**************************/
void genKey(unsigned char *key) {
    int i;
    genseed();
    for (i=0; i<KEYSIZE; i++)
	 key[i] = rand();
}