get("#356") -- num2hex get("#348") -- rgb functions function hashImage(img) local hash = 0 local w, h = img.width, img.height for y = 0, h-1 do for x = 0, w-1 do local pix = img.getInt(x, y) local r, g, b = rgb(pix) local p = r+g*33+b*71 local scale = bit32.band(y*w+x, 0xFFFF)+1 --hash = (hash * a + pix) % 0x100000000 --a = (a * b) % 0x100000000 local arg = (p+1)*scale hash = bit32.bxor(hash, arg) --[[if x < 10 then print("scale", scale, "pix", pix, "p", p, "arg", arg, "hash", hash) end]] end --print("y", y, "hash", hash) end return num2hex(hash, 8) end
Probably fairly crappy (might cause hash collisions), but I guess it can be used for now
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment