]> git.zerfleddert.de Git - proxmark3-svn/blob - common/random.c
ADD: @micolous random nonce, adjusted to fit in. Icemanfork only uses Moebius attac...
[proxmark3-svn] / common / random.c
1 #include "random.h"
2
3 static uint64_t next_random = 1;
4
5 /* Generates a (non-cryptographically secure) 32-bit random number.
6 *
7 * We don't have an implementation of the "rand" function. Instead we use a
8 * method of seeding with the time it took to call "autoseed" from first run.
9 *
10 * https://github.com/Proxmark/proxmark3/pull/209/commits/f9c1dcd9f6e68a8c07cffed697a9c4c8caed6015
11 */
12 uint32_t prand() {
13 if (next_random == 1)
14 next_random = GetTickCount();
15
16 next_random = next_random * 6364136223846793005 + 1;
17 return (uint32_t)(next_random >> 32) % 0xffffffff;
18 }
19
Impressum, Datenschutz