samedi 14 mars 2015

how to read bitwise operation, what it actually does


i need to be certain about some bitwise operation in memory. This C code is too low level for me, but i need to understand and then improve it. decalage bit Its from an algorithm called feistel structure, using a key and "XOR" with 32bits data block. its bit shifting ..


These are the lines that i don't get really even if i know most of the C operators.


char *pkey;


int64_t keym;



while(*pkey) {
keym = keym*16 + (*pkey <= 57 && *pkey >= 48 ? *pkey - 48 : *pkey - 55);
pkey++; }


char *tmp;

tmp |= (keym&254L << 8*i) >> i + 1;

int64_t k;
define MYBIT _|_

k = k << 4 | z(k << 4, 56) & (MYBIT << 24);



int64_t a, b, lb

if(y&8) |
return bl; |
a = bl >> 32&((1L << 32)-1); |
b = (bl&(1L << 32) -1); |
a = a^b^rotate(keym, y);

|
bl = y < 7 ? (b << 32) + a : (a << 32) + b;


Thanks for any explanation, as clear as possible for me to re-use this code.




Aucun commentaire:

Enregistrer un commentaire