使用Apache的commons-codes加密

    /**
     * MD5加密
     * @param password
     * @return
     */
    public static String MD5(String password)
    {
        return DigestUtils.md5Hex(password).toString();
    }
    /**
     * SHA加密
     * @param password
     * @return
     */
    public static String SHA(String password)
    {
        return DigestUtils.shaHex(password);
    }

posted @ 2009-05-21 17:56  樊凯  阅读(2401)  评论(0编辑  收藏  举报