srecord noeq HashBWImage(BWImage img) { long hash; long get() { if (img == null) ret hash; int w = img.getWidth(), h = img.getHeight(); int n = w*h; byte[] pixels = img.pixels; addToHash(w); addToHash(h); for i to n: addToHash(0xFF000000 | rgbIntFromGrayscale(ubyteToInt(pixels[i]))); ret hash; } void addToHash(long x) { hash = boostHashCombine64(hash, x); printVars ifdef HashBWImage_debug(x := longToHex(x), +hash); } }