Skip to content

Instantly share code, notes, and snippets.

@Codezigineer
Last active February 5, 2023 03:19
Show Gist options
  • Save Codezigineer/51dd2dea1626c5af82addac4b62a9f00 to your computer and use it in GitHub Desktop.
Save Codezigineer/51dd2dea1626c5af82addac4b62a9f00 to your computer and use it in GitHub Desktop.
Cryptorand.c
#include <stdlib.h>
unsigned char clz32(unsigned int x)
{
return __builtin_clz(x);
};
unsigned char *randomData(unsigned length)
{
unsigned char *array = (unsigned char *)malloc(length);
unsigned i = length;
while(i--)
{
unsigned int num = ((unsigned int)random() * 16777216) >>> 0;
num = num + (num % 16777213);
array[i] = ((((((unsigned int)random() * 16777216) % num)) * 8) >>> 0) % ((unsigned int)random() * 256) ^ clz32((unsigned int)random() * 256) ^ i;
};
return array;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment