FileDocCategorySizeDatePackage
StandardPasswordDigest.javaAPI DocAndroid 1.5 API1801Wed May 06 22:42:46 BST 2009com.android.im.imps

StandardPasswordDigest

public class StandardPasswordDigest extends Object implements PasswordDigest

Fields Summary
Constructors Summary
Methods Summary
public java.lang.Stringdigest(java.lang.String schema, java.lang.String nonce, java.lang.String password)

        byte[] digestBytes;
        byte[] inputBytes;

        try {
            inputBytes = (nonce + password).getBytes("ISO-8859-1");
        } catch (UnsupportedEncodingException e) {
            throw new ImException(e);
        }

        try {
            if ("SHA".equals(schema))
                schema = "SHA-1";
            MessageDigest md = MessageDigest.getInstance(schema);
            digestBytes = md.digest(inputBytes);
        } catch (NoSuchAlgorithmException e) {
            throw new ImException("Unsupported schema: " + schema);
        }
        return new String(Base64.encodeBase64(digestBytes));
    
public java.lang.String[]getSupportedDigestSchema()

        return new String[] {"MD5", "SHA"};