Android Hash Code Calculate hashBitmap(Bitmap bitmap)

Here you can find the source of hashBitmap(Bitmap bitmap)

Description

hash Bitmap

Declaration

public static int hashBitmap(Bitmap bitmap) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    public static int hashBitmap(Bitmap bitmap) {
        int hash_result = 0;
        int w = bitmap.getWidth();
        int h = bitmap.getHeight();
        hash_result = (hash_result << 7) ^ h;
        hash_result = (hash_result << 7) ^ w;
        for (int pixel = 0; pixel < 20; ++pixel) {
            int x = (pixel * 50) % w;
            int y = (pixel * 100) % h;
            hash_result = (hash_result << 7) ^ bitmap.getPixel(x, y);
        }/* ww w. jav a2  s .c o m*/
        return hash_result;
    }
}

Related

  1. hash(char[] pin, byte[] salt)
  2. hash(int seed, Object o)
  3. hash(int seed, boolean x)
  4. hash(int seed, int x)
  5. hash2jsonBytes(Map hash)
  6. hashBitmap(Bitmap bitmap)
  7. hashCode(T a)
  8. hashCode(T a, T b)
  9. hashCode(T a, T b, T c)