FileDocCategorySizeDatePackage
MessageDigest.javaAPI DocAndroid 1.5 API2099Wed May 06 22:41:56 BST 2009android.security

MessageDigest

public abstract class MessageDigest extends Object
Base class for producing a message digest from different hash encryptions.

Fields Summary
Constructors Summary
Methods Summary
public abstract byte[]digest()

public abstract byte[]digest(byte[] input)
Produces a message digest for the given input.

param
input The message to encrypt.
return
The digest (hash sum).

public static android.security.MessageDigestgetInstance(java.lang.String algorithm)
Returns a digest object of the specified type.

param
algorithm The type of hash function to use. Valid values are SHA-1 and MD5.
return
The respective MessageDigest object. Either a {@link android.security.Sha1MessageDigest} or {@link android.security.Md5MessageDigest} object.
throws
NoSuchAlgorithmException If an invalid algorithm is given.

        if (algorithm == null) {
            return null;
        }
        
        if (algorithm.equals("SHA-1")) {
            return new Sha1MessageDigest();
        }
        else if (algorithm.equals("MD5")) {
            return new Md5MessageDigest();
        }
        
        throw new NoSuchAlgorithmException();
    
public abstract voidupdate(byte[] input)