mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 21:33:19 -07:00
Refactor parity functions
- get rid of __asm function in crapto1.h, use gcc builtin function instead - make parity functions available in common directory
This commit is contained in:
parent
f513388ee0
commit
1f065e1dad
14 changed files with 127 additions and 90 deletions
|
@ -18,7 +18,9 @@
|
|||
Copyright (C) 2008-2008 bla <blapost@gmail.com>
|
||||
*/
|
||||
#include "crapto1.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "parity.h"
|
||||
|
||||
#define SWAPENDIAN(x)\
|
||||
(x = (x >> 8 & 0xff00ff) | (x & 0xff00ff) << 8, x = x >> 16 | x << 16)
|
||||
|
@ -73,7 +75,7 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted)
|
|||
feedin ^= !!in;
|
||||
feedin ^= LF_POLY_ODD & s->odd;
|
||||
feedin ^= LF_POLY_EVEN & s->even;
|
||||
s->even = s->even << 1 | parity(feedin);
|
||||
s->even = s->even << 1 | evenparity32(feedin);
|
||||
|
||||
t = s->odd, s->odd = s->even, s->even = t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue