F5Random random = new F5Random(password.getBytes()); Permutation permutation = new Permutation(coeff.length, random); int k = determineCodeParameter(coeff, embeddedData.available()); n = (1<<k)-1; if (n > 1) { //use matrix encoding (1, n, k) int kBitsToEmbed; int extractedBit; int hash; int s; int[] codeWord = new int[n]; int startOfN=0; int endOfN=0; embeddingLoop: for (;;) { //End continuous loop if (embeddedData.available()==0) break; //End of message, leave end continuous loop kBitsToEmbed = embeddedData.readBits(k); do { //embed k bits j = startOfN; for (i=0; i22 if (j>=coeff.length) // break embeddingLoop; // beende Endlosschleife shuffledIndex = permutation.getShuffled(j); if (shuffledIndex%64 == 0) continue; // skip DC if (coeff[shuffledIndex] == 0) continue; // skip 0 codeWord[i++]=shuffledIndex; } endOfN = j; //notice codeword end hash = 0; for (i=0; i<n;>34 if (coeff[codeWord[i]] > 0) extractedBit = coeff[codeWord[i]]&1; else extractedBit = 1-(coeff[codeWord[i]]&1); if (extractedBit == 1) hash ^= i+1; } s = hash ^ kBitsToEmbed; if (s==0) break; //no change is necessary if (coeff[codeWord[--s0) // decrement amount coeff[codeWord[s]]--; else coeff[codeWord[s]]++; } while (coeff[codeWord[s]]==0); startOfN = endOfN; // continue with new coefficients } } else ... // without matrix coding
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)