]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java
3 The file is used to caculate file MD5 value.
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.far
;
18 import java
.io
.FileInputStream
;
19 import java
.security
.MessageDigest
;
23 static public String
md5(File file
) throws Exception
{
24 byte[] buffer
= new byte[(int) file
.length()];
25 FileInputStream fInput
= new FileInputStream(file
);
32 static public String
md5(byte[] buffer
) throws Exception
{
33 MessageDigest md
= MessageDigest
.getInstance("MD5");
34 byte[] md5
= md
.digest(buffer
);
35 return new String(String
.format("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", md5
[0], md5
[1], md5
[2], md5
[3], md5
[4],
36 md5
[5], md5
[6], md5
[7], md5
[8], md5
[9], md5
[10], md5
[11], md5
[12], md5
[13],