140 lines
4.0 KiB
JavaScript
140 lines
4.0 KiB
JavaScript
async function sending(s, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, client_ip, visitorId) {
|
|
await sleep();
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.open('POST', 'https://receive.unloze.com/', true);
|
|
xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
xhttp.send("name=" + JSON.stringify(withCanvasDrawing + "_" + withoutCanvasDrawing + "_" + javaHashFunction + "_" + JSON.stringify(s)
|
|
+ "_" + JSON.stringify(visitorId)) + " " + JSON.stringify(client_ip));
|
|
}
|
|
|
|
function sleep() {
|
|
return new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 5) * 1000));
|
|
}
|
|
|
|
function sieve(client_ip, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, visitorId){
|
|
function xfunc(num, root){
|
|
return (Math.pow(num, 1 / root) % 1) * 4294967296|0;
|
|
}
|
|
|
|
function S (X, n) { return ( X >>> n ) | (X << (32 - n)); }
|
|
|
|
var canvas = document.body.appendChild(document.createElement('canvas'));
|
|
var ctx = canvas.getContext('2d');
|
|
canvas.height = 200;
|
|
canvas.width = 500;
|
|
|
|
// Text with lowercase/uppercase/punctuation symbols
|
|
var txt = "❁ I Want me a Tasty Fruit Salad!\n\r <🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🍍🥝>";
|
|
ctx.textBaseline = "top";
|
|
// The most common type
|
|
ctx.font = "14px 'Arial'";
|
|
ctx.textBaseline = "alphabetic";
|
|
ctx.fillStyle = "#f60";
|
|
ctx.fillRect(125,1,62,20);
|
|
// Some tricks for color mixing to increase the difference in rendering
|
|
ctx.fillStyle = "#069";
|
|
ctx.fillText(txt, 2, 15);
|
|
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
|
ctx.fillText(txt, 4, 17);
|
|
|
|
// canvas blending
|
|
// http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/
|
|
// http://jsfiddle.net/NDYV8/16/
|
|
ctx.globalCompositeOperation = "multiply";
|
|
ctx.fillStyle = "rgb(255,0,255)";
|
|
ctx.beginPath();
|
|
ctx.arc(50, 50, 50, 0, Math.PI * 2, true);
|
|
ctx.closePath();
|
|
ctx.fill();
|
|
ctx.fillStyle = "rgb(0,255,255)";
|
|
ctx.beginPath();
|
|
ctx.arc(100, 50, 50, 0, Math.PI * 2, true);
|
|
ctx.closePath();
|
|
ctx.fill();
|
|
ctx.fillStyle = "rgb(255,255,0)";
|
|
ctx.beginPath();
|
|
ctx.arc(75, 100, 50, 0, Math.PI * 2, true);
|
|
ctx.closePath();
|
|
ctx.fill();
|
|
ctx.fillStyle = "rgb(255,0,255)";
|
|
// canvas winding
|
|
// http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/
|
|
// http://jsfiddle.net/NDYV8/19/
|
|
ctx.arc(75, 75, 75, 0, Math.PI * 2, true);
|
|
ctx.arc(75, 75, 25, 0, Math.PI * 2, true);
|
|
ctx.fill("evenodd");
|
|
|
|
void function res1(){
|
|
b = canvas.toDataURL()
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
var i = 1,
|
|
K = [];
|
|
|
|
while(++i < 18){
|
|
for(j = i * i; j < 312; j += i){
|
|
K[j] = 1;
|
|
}
|
|
}
|
|
|
|
var H = [];
|
|
|
|
for(i = 1, j = 0; i < 313; ){
|
|
if(!K[++i]){
|
|
H[j] = xfunc(i,2);
|
|
K[j++] = xfunc(i,3);
|
|
}
|
|
}
|
|
//console.log(JSON.parse(JSON.stringify(K)))
|
|
//console.log(JSON.parse(JSON.stringify(H)))
|
|
|
|
|
|
var HASH = H.slice(i = 0),
|
|
s = unescape(encodeURI(b)), /* encode as utf8 */
|
|
W = [],
|
|
l = s.length,
|
|
m = [],
|
|
a, y, z;
|
|
for(; i < l; ) m[i >> 2] |= (s.charCodeAt(i) & 0xff) << 8 * (3 - i++ % 4);
|
|
|
|
l *= 8;
|
|
|
|
m[l >> 5] |= 0x80 << (24 - l % 32);
|
|
m[z = (l + 64 >> 5) | 15] = l;
|
|
|
|
for(i = 0; i < z; i += 16){
|
|
a = HASH.slice(j = 0, 8);
|
|
|
|
for(; j < 64; a[4] += y){
|
|
if(j < 16){
|
|
W[j] = m[j + i];
|
|
}else{
|
|
W[j] =
|
|
(S(y = W[j - 2], 17) ^ S(y, 19) ^ (y >>> 10)) +
|
|
(W[j - 7]|0) +
|
|
(S(y = W[j - 15], 7) ^ S(y, 18) ^ (y >>> 3)) +
|
|
(W[j - 16]|0);
|
|
}
|
|
|
|
a.unshift(
|
|
(
|
|
y = (
|
|
a.pop() +
|
|
(S(b = a[4], 6) ^ S(b, 11) ^ S(b, 25)) +
|
|
(((b & a[5]) ^ ((~b) & a[6])) + K[j])|0
|
|
) +
|
|
(W[j++]|0)
|
|
) +
|
|
(S(l = a[0], 2) ^ S(l, 13) ^ S(l, 22)) +
|
|
((l & a[1]) ^ (a[1] & a[2]) ^ (a[2] & l))
|
|
);
|
|
}
|
|
|
|
for(j = 8; j--; ) HASH[j] = a[j] + HASH[j];
|
|
}
|
|
|
|
for(s = ''; j < 63; ) s += ((HASH[++j >> 3] >> 4 * (7 - j % 8)) & 15).toString(16);
|
|
sending(s, withCanvasDrawing, withoutCanvasDrawing, javaHashFunction, client_ip, visitorId);
|
|
}();
|
|
};
|
|
|