Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; public class Main { /** * calculate hashcode for a bitmap. * only calculate part of the first row for performance purpose. * if you want to involve every pixels, use {@link #bitmap2hashFull(Bitmap)}. * @return hash code */ public static long bitmap2hash(Bitmap bitmap) { if (bitmap == null) return 0; long hash = 31; int end = bitmap.getWidth() / 5; for (int x = 0; x < end; x++) { hash *= (bitmap.getPixel(x, 0) + 31); } return hash; } }