File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import division , absolute_import , print_function
2
2
3
3
from randomstate .prng .mt19937 import *
4
+ from randomstate .entropy import random_entropy
4
5
import randomstate .prng
Original file line number Diff line number Diff line change @@ -142,9 +142,14 @@ uint32_t entropy_randombytes(void) {
142
142
gettimeofday (& tv , NULL );
143
143
return entropy_hash_32 (getpid ()) ^ entropy_hash_32 (tv .tv_sec ) ^ entropy_hash_32 (tv .tv_usec ) ^ entropy_hash_32 (clock ());
144
144
#else
145
+ uint32_t out = 0 ;
146
+ int64_t counter ;
145
147
struct _timeb tv ;
146
148
_ftime (& tv );
147
- return entropy_hash_32 (GetCurrentProcessId ()) ^ entropy_hash_32 ((uint32_t )tv .time ) ^ entropy_hash_32 (tv .millitm ) ^ entropy_hash_32 (clock ());
149
+ out = entropy_hash_32 (GetCurrentProcessId ()) ^ entropy_hash_32 ((uint32_t )tv .time ) ^ entropy_hash_32 (tv .millitm ) ^ entropy_hash_32 (clock ());
150
+ if (QueryPerformanceCounter ((LARGE_INTEGER * )& counter ) != 0 )
151
+ out ^= entropy_hash_32 ((uint32_t )(counter & 0xffffffff ));
152
+ return out ;
148
153
#endif
149
154
}
150
155
You can’t perform that action at this time.
0 commit comments