betteryao/OTExtension/util/crypto/crypto.cpp
void gen_secure_random(uint8_t* dest, uint32_t nbytes) {
	int32_t randomData = open("/dev/random", O_RDONLY);
	uint32_t bytectr = 0;
	while (bytectr < nbytes) {
		uint32_t result = read(randomData, dest + bytectr, nbytes - bytectr);
		if (result < 0) {
			cerr << "Unable to read from /dev/random, exiting" << endl;
			exit(0);
		}
		bytectr += result;
	}
	close(randomData);
}
//Read random bytes from /dev/random - copied from stackoverflow (post by zneak)
Read random bytes from /dev/random - copied from stackoverflow (post by zneak)
Read random bytes from / dev / random - copied from stackoverflow ( post by zneak )
void gen_secure_random(uint8_t* dest, uint32_t nbytes) {
	int32_t randomData = open("/dev/random", O_RDONLY);
	uint32_t bytectr = 0;
	while (bytectr < nbytes) {
		uint32_t result = read(randomData, dest + bytectr, nbytes - bytectr);
		if (result < 0) {
			cerr << "Unable to read from /dev/random, exiting" << endl;
			exit(0);
		}
		bytectr += result;
	}
	close(randomData);
}
void gen_secure_random ( uint8_t * dest , uint32_t nbytes ) { int32_t randomData = open ( " " , O_RDONLY ) ; uint32_t bytectr = 0 ; while ( bytectr < nbytes ) { uint32_t result = read ( randomData , dest + bytectr , nbytes - bytectr ) ; if ( result < 0 ) { cerr << " " << endl ; exit ( 0 ) ; } bytectr += result ; } close ( randomData ) ; }
Read random bytes from /dev/random - copied from stackoverflow (post by zneak)
Read random bytes from / dev / random - copied from stackoverflow ( post by zneak )