mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
summer restructuring:
* .h include only the strict minimum for their own parsing * this forces all files to include explicitment their needs and not count on far streched dependencies * this helps Makefile to rebuild only the minimum * according to this rule, most standalone .h are now gone * big app.h is gone * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway * all unrequired include were removed * split common/ into common/ (client+arm) and common_arm/ (os+bootloader) * bring zlib to common/ * bring stuff not really/not yet used in common back to armsrc/ or client/ * bring liblua into client/ * bring uart into client/ * move some portions of code around (dbprint, protocols,...) * rename unused files into *_disabled.[ch] to make it explicit * rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash * remove PrintAndLogDevice * move deprecated-hid-flasher from client to tools * Makefiles * treat deps in armsrc/ as in client/ * client: stop on warning (-Werror), same as for armsrc/ Tested on: * all standalone modes * Linux
This commit is contained in:
parent
b7d412d27b
commit
d19754567d
447 changed files with 2553 additions and 2599 deletions
39
client/prng.c
Normal file
39
client/prng.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Burtle Prng - Modified. 42iterations instead of 20.
|
||||
// ref: http://burtleburtle.net/bob/rand/smallprng.html
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "prng.h"
|
||||
|
||||
#define rot(x,k) (((x)<<(k))|((x)>>(32-(k))))
|
||||
uint32_t burtle_get_mod(prng_ctx *x) {
|
||||
uint32_t e = x->a - rot(x->b, 21);
|
||||
x->a = x->b ^ rot(x->c, 19);
|
||||
x->b = x->c + rot(x->d, 6);
|
||||
x->c = x->d + e;
|
||||
x->d = e + x->a;
|
||||
return x->d;
|
||||
}
|
||||
|
||||
void burtle_init_mod(prng_ctx *x, uint32_t seed) {
|
||||
x->a = 0xf1ea5eed;
|
||||
x->b = x->c = x->d = seed;
|
||||
for (uint8_t i = 0; i < 42; ++i) {
|
||||
(void)burtle_get_mod(x);
|
||||
}
|
||||
}
|
||||
|
||||
void burtle_init(prng_ctx *x, uint32_t seed) {
|
||||
uint32_t i;
|
||||
x->a = 0xf1ea5eed, x->b = x->c = x->d = seed;
|
||||
for (i = 0; i < 20; ++i) {
|
||||
(void)burtle_get_mod(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t GetSimplePrng(uint32_t seed) {
|
||||
seed *= 0x19660D;
|
||||
seed += 0x3C6EF35F;
|
||||
return seed;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue