VBS obtains the MD5 value of a file (without components) and vbsmd5

Source: Internet
Author: User
Tags md5 hash

VBS obtains the MD5 value of a file (without components) and vbsmd5

The following code can obtain the MD5 value without components.

Copy codeThe Code is as follows:
Option Explicit
Dim wi
Dim file
Dim file_size
Dim file_attributes
Dim file_version
Dim file_hash
Set wi = CreateObject ("WindowsInstaller. Installer ")
File = "111.exe"
File_size = wi. FileSize (file)
File_attributes = wi. FileAttributes (file)
File_version = wi. FileVersion (file)
File_hash = GetFileHash (file)
Set wi = Nothing
MsgBox "File:" & file & vbCrLf &_
"Size:" & file_size & vbCrLf &_
"Attributes:" & file_attributes & vbCrLf &_
"Version:" & file_version & vbCrLf &_
"MD5:" & file_hash
Function GetFileHash (file_name)
Dim file_hash
Dim hash_value
Dim I
Set file_hash = wi. FileHash (file_name, 0)
Hash_value = ""
For I = 1 To file_hash.FieldCount
Hash_value = hash_value & BigEndianHex (file_hash.IntegerData (I ))
Next
GetFileHash = hash_value
Set file_hash = Nothing
End Function
Function BigEndianHex (Int)
Dim result
Dim b1, b2, b3, b4
Result = Hex (Int)
B1 = Mid (result, 7, 2)
B2 = Mid (result, 5, 2)
B3 = Mid (result, 3, 2)
B4 = Mid (result, 1, 2)
BigEndianHex = b1 & b2 & b3 & b4
End Function


Urgent: The vbs code can calculate the MD5 value of the string. I wonder if it can be used to calculate the file?

Efficiency constraints of VBS: Do you want to check if I recently write an MD5 HASH algorithm DLL?

How does VB obtain the MD5 value of a file?

M5home.com/bbs/dispbbs.asp? Boolean ID = 10 & ID = 1479
Visitor account: everyone
Visitor password: 123456
Please use this account password

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.