srecord noeq HashBinaryImage(IBinaryImage img) { long hash; long get() { if (img == null) ret hash; var img = this.img.toImage2B(); int w = img.getWidth(), h = img.getHeight(); int n = w*h; byte[] pixels = img.pixels; addToHash(w); addToHash(h); for i to n: addToHash((pixels[i/8] & (1 << (i & 7))) != 0 ? 0xFFFFFFFF : 0xFF000000); ret hash; } void addToHash(long x) { hash = boostHashCombine64(hash, x); } }