Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void EmbedWatermark(short *vals, char *msg)
- {
- int chars = NUM_CHARS;
- int numVals = LSBS, numChars = BITS_PER_CHAR, mask;
- while(chars--)
- {
- while(numChars){
- if(numVals <= numChars)
- {
- mask = (1<<numVals)-1;
- *vals = (*msg >> BITS_PER_CHAR - numChars & mask) | (*vals & ~mask);
- numChars -= numVals;
- numVals = LSBS;
- vals++;
- }
- else
- {
- mask = (1<<numChars)-1;
- *vals = (*msg >> BITS_PER_CHAR - numChars & mask) << (numVals - numChars) | (*vals & ~((1<<numVals)-1));
- numVals -= numChars;
- numChars = 0;
- }
- }
- msg++;
- numChars = BITS_PER_CHAR;
- }
- }
- void PrintWatermark(short *copy)
- {
- int chars = NUM_CHARS;
- int numChars = BITS_PER_CHAR;
- int numVals = LSBS;
- int mask;
- char printChar = 0;
- while(chars)
- {
- while(numChars != 0)
- {
- if(numChars < LSBS)
- {
- mask = (1<<numChars)-1;
- printChar = (*copy >> LSBS - numChars & mask) << (BITS_PER_CHAR - numChars) | printChar;
- numVals = LSBS - numChars;
- numChars = 0;
- }
- else
- {
- mask = (1<<numVals)-1;
- printChar = (*copy & mask) << BITS_PER_CHAR - numChars | printChar;
- numChars -= numVals;
- numVals = 3;
- copy++;
- }
- }
- printf("%c\n", printChar);
- printChar = 0;
- numChars = BITS_PER_CHAR;
- chars--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement