Code example for MessageDigest

Methods: digest

0
     * @return md5 byte[16] 
     */ 
    public byte[] hash(final String str) {
        opLock.lock();
        try { 
            final byte[] bt = mHasher.digest(str.getBytes());
            if (null == bt || bt.length != 16) {
                throw new IllegalArgumentException("md5 need");
            } 
            return bt;
        } 
        finally { 
            opLock.unlock();
        } 
    } 
 
 
    /** 
     * ¶Ô×Ö·û´®½øÐÐmd5 string 
     *  
     * @param str