]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/util.c
FIX: "hf legic decode" the stamp_len variable was int, but its used as a uint8_t.
[proxmark3-svn] / client / util.c
index 9d4c83ee2b975e997a6db42e1b3eb8c9e9061b48..fcda9bde0ae7815bf46d1e2c0567c564f43cb526 100644 (file)
@@ -503,10 +503,18 @@ uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits) {
 
 // RotateLeft - Ultralight, Desfire, works on byte level
 // 00-01-02  >> 01-02-00
-void rol(uint8_t *data, const size_t len){
+void rol(uint8_t *data, const size_t len){     
     uint8_t first = data[0];
     for (size_t i = 0; i < len-1; i++) {
         data[i] = data[i+1];
     }
     data[len-1] = first;
+}
+
+uint32_t SwapBits(uint32_t value, int nrbits) {
+       uint32_t newvalue = 0;
+       for(int i = 0; i < nrbits; i++) {
+               newvalue ^= ((value >> i) & 1) << (nrbits - 1 - i);
+       }
+       return newvalue;
 }
\ No newline at end of file
Impressum, Datenschutz