public static byte[] md5Bytes(byte[] bs) {
        if (bs == null) return null;
        MessageDigest md5;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }
        return md5.digest(bs);
    }
public static byte [ ] md5Bytes ( byte [ ] bs ) { if ( bs == null ) return null ; MessageDigest md5 ; try { md5 = MessageDigest . getInstance ( "MD5" ) ; } catch ( NoSuchAlgorithmException ex ) { throw new RuntimeException ( ex ) ; } return md5 . digest ( bs ) ; }
MD5加密

@param bs 待加密数据

@return md5值