char encrypt(char a)
{
unsigned bitfield :8;
bitfield = a;
int offset = 0;
if(bitfield :1 != bitfield :2)
bitfield |= 64; // 64 is the 7th bit
return (char) bitfield;
};
encryption
I think that I have encryption all figured out and such, but still, look at my (simple) code that encrypts a single character by flipping bits (a char* can be run through this, as well as int's).
Another question: is there a simple way to split a short into 2 bytes and a long into 4 bytes for the latter?
[edited by - zackriggle on December 2, 2002 5:02:09 PM]
unsigned long dwLong = 123456;unsigned char* pbyBuff = (unsigned char*)&dwLong
Now pbyBuff[0] ... pbyBuff[3] contain the four bytes of dwLong.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement