package org.javarosa.core.util.externalizable;

/**
 * Abstract hashing class defining the basic outline of performing a hash. Hasher
 * implementations must override getHash and getHashSize. getClassHashValue() handles
 * array creation and copying with these methods defined.
 *
 * @author ctsims
 * @author wspride
 */
public abstract class Hasher {

    public byte[] getClassHashValue(Class type){
        byte[] returnHash = new byte[this.getHashSize()];
        byte[] computedHash = getHash(type); //add support for a salt, in case of collision?

        for(int i=0; i< returnHash.length && i<computedHash.length; i++){
            returnHash[i] = computedHash[i];
        }

        return returnHash;
    }
    public abstract int getHashSize();
    public abstract byte[] getHash(Class c);
}

@@ -394,16 +394,17 @@
 ss type)
+ 
 %7B%0A      
@@ -438,13 +438,8 @@
 yte%5B
-this.
 getH
@@ -559,19 +559,23 @@
  for
+ 
 (int i
-=
+ = 
 0; i
+ 
 %3C re
@@ -594,17 +594,19 @@
 gth && i
-%3C
+ %3C 
 computed
@@ -622,16 +622,17 @@
 th; i++)
+ 
 %7B%0A      
@@ -714,16 +714,17 @@
 ;%0A    %7D%0A
+%0A
     publ
@@ -754,16 +754,17 @@
 Size();%0A
+%0A
     publ

Indent file