Reputation: 13
I have two uint_16ts that I've gotten from the nibbles of my data as seen in the code below. I need to put that into mask set so that each of the nibbles are now in its own byte. The code I got is below I can't for the life of me figure it out. I need to do this cause this will create the mask I will use to unmask mildly encrypted data.
uint16_t length = *(offset+start) - 3;
uint16_t mask = length;
if(Fmt == ENCRYPTED) {
char frstDig = (length & 0x000F)
char scndDig = (length & 0x00F0) >> 4;
mask =
Upvotes: 1
Views: 258
Reputation: 781741
Shift one of the digits by 8 bits, and OR them together.
mask = (scndDig << 8) | frstDig;
Upvotes: 1