#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <time.h>

void make_randmsg( unsigned char* msg, int byte_size );

int main()
{
 unsigned char* key;
 int keylen = 65536;

 key = (unsigned char*)malloc(sizeof(unsigned char) * (keylen*2) );

 make_randmsg(key, keylen);

 return 0;
}

void make_randmsg(unsigned char* msg, int byte_size)
{
 int i = 0;
 int randnum;
 
 memset(msg, \'\\0\', byte_size*2);
 
 srand((unsigned int)time(NULL));

 if(byte_size == 0)
  msg = NULL;
 
 else
 {
  for( i = 0 ; i < byte_size ; i++)
  {
   randnum = rand() % 256;
   sprintf((char *)msg, \"%s%02x\", msg, randnum);
  }
 }
 
 printf(\"%d byte random Message : \\n\", byte_size);
 printf(\"%s\\n\\n\", msg);       // Testing 용

}



이게 제가 짠 코든데요..

한 10000 byte 정도까지는 한2~3초 정도 거려서 생성이되는데요


제가 해야되는건 65536 byte길이를 생성해야 되는데..

한바이트씩 생성해서 이어붙이기로 하니깐 오래 걸리더라구요....

코드 보시고 혹시 속도를 좀 빠르게 생성해낼수 있는 방법 아시는 분 계시면 코멘트좀 달아주세요 ㅠ