library/src/utility/BP-StringUtilities.cc
// Generates a random SHA1() hash in ascii (40bytes random as ascii)
Generates a random SHA1() hash in ascii (40bytes random as ascii)
Generates a random SHA1 () hash in ascii ( 40bytes random as ascii )
char * BP_GenRandomSHA1()
{
	char *random_sha1 = (char *) bpcalloc(41, 1);
	unsigned char *random_data = BP_GenRandomUnsignedCharString(20);
	sprintf
	(
			random_sha1, "%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x",
			random_data[0],
			random_data[1],
			random_data[2],
			random_data[3],
			random_data[4],
			random_data[5],
			random_data[6],
			random_data[7],
			random_data[8],
			random_data[9],
			random_data[10],
			random_data[11],
			random_data[12],
			random_data[13],
			random_data[14],
			random_data[15],
			random_data[16],
			random_data[17],
			random_data[18],
			random_data[19]
	);
	bpfree(random_data);
	return random_sha1;
}
char * BP_GenRandomSHA1 ( ) { char * random_sha1 = ( char * ) bpcalloc ( 41 , 1 ) ; unsigned char * random_data = BP_GenRandomUnsignedCharString ( 20 ) ; sprintf ( random_sha1 , " " , random_data [ 0 ] , random_data [ 1 ] , random_data [ 2 ] , random_data [ 3 ] , random_data [ 4 ] , random_data [ 5 ] , random_data [ 6 ] , random_data [ 7 ] , random_data [ 8 ] , random_data [ 9 ] , random_data [ 10 ] , random_data [ 11 ] , random_data [ 12 ] , random_data [ 13 ] , random_data [ 14 ] , random_data [ 15 ] , random_data [ 16 ] , random_data [ 17 ] , random_data [ 18 ] , random_data [ 19 ] ) ; bpfree ( random_data ) ; return random_sha1 ; }
Generates a random SHA1() hash in ascii (40bytes random as ascii)
Generates a random SHA1 () hash in ascii ( 40bytes random as ascii )
// create buffer first for uuid // generate 40 bytes of random data // destroy the random data // return the random uuid value