/** * 获取上传文件的md5 * * @param file * @return * @throws NoSuchAlgorithmException * @throws IOException */ public String getMd5(MultipartFile file) { try { byte[] uploadBytes = file.getBytes(); MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] digest = md5.digest(uploadBytes); String hashString = new BigInteger(1, digest).toString(16); return hashString; } catch (Exception e) { LogUtil.writeErrorLog(e.toString(), e); } return null; }
java 获取上传文件的MD5值
猜你喜欢
转载自kissuyoyo.iteye.com/blog/2332972
今日推荐
周排行