mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
6d7a9fc22a
commit
960f3c4f36
@ -46,7 +46,7 @@
|
||||
var l = desc.length;
|
||||
var rng = randomSupply.getRng(l, window);
|
||||
|
||||
for (var i = 0; i < l; i += 10){
|
||||
for (var i = 0; i < l; i += 1){
|
||||
desc[i] = rng(source[i], i);
|
||||
}
|
||||
var canvas = original.cloneNode(true);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// extract the bit
|
||||
var bit = (bitSet[index] >>> bitIndex) & 0x01;
|
||||
|
||||
// XOR the bit the the value to alter the last bit of it... or not
|
||||
// XOR the bit and the value to alter the last bit of it... or not
|
||||
return value ^ bit;
|
||||
};
|
||||
}
|
||||
@ -52,27 +52,8 @@
|
||||
var rnd = randomNumbers[randomI];
|
||||
randomI += 1;
|
||||
|
||||
// do not alter the most significant bit that is set and
|
||||
// the bit after it, to not disturb the image too much.
|
||||
if (value >= 0x80){
|
||||
value = value ^ (rnd & 0x1F);
|
||||
}
|
||||
else if (value >= 0x40){
|
||||
value = value ^ (rnd & 0x0F);
|
||||
}
|
||||
else if (value >= 0x20){
|
||||
value = value ^ (rnd & 0x07);
|
||||
}
|
||||
else if (value >= 0x10){
|
||||
value = value ^ (rnd & 0x03);
|
||||
}
|
||||
else if (value >= 0x08){
|
||||
value = value ^ (rnd & 0x01);
|
||||
}
|
||||
// else if (value >= 0x04){
|
||||
// value = value ^ (rnd * 0x00);
|
||||
// }
|
||||
return value;
|
||||
// XOR the last bit to alter it... or not
|
||||
return value ^ (rnd & 0x01);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user