PowerShell Get-FileHash
เรียนรู้วิธีใช้คำสั่ง Microsoft PowerShell Get-FileHash โดยใช้ PowerShell ซึ่งจะใช้ได้กับไฟล์ทุกประเภท ไม่ว่าจะเป็น exe, msi, docx, pdf, iso และอื่นๆ
วิธีทำ hash Checksum บน Windows (ไม่ต้องใช้แอพ)
Computes the hash value for a file by using a specified hash algorithm.
Download picture SHA1: 9bcddbdc6e669ce7b3aaf031699fadcfed3eb6eb
PS#Get-FileHash D:\Lab\Hash\PIC1.jpg | Format-List
การใช้ Power Shell
1. กดWindows+Rเพื่อเปิดกล่องRun
2. พิมพ์powershel l แล้วคลิกตกลง
3. หน้าต่าง Windows PowerShell จะเปิดขึ้น
4. รันคำสั่งต่อไปนี้:
Examples 1: Compute the hash value for a file
This example uses the Get-FileHash
cmdlet to compute the hash value for the /etc/apt/sources.list
file. The hash algorithm used is the default, SHA256. The output is piped to the Format-List
cmdlet to format the output as a list.
Get-FileHash /etc/apt/sources.list | Format-List Algorithm : SHA256 Hash : 3CBCFDDEC145E3382D592266BE193E5BE53443138EE6AB6CA09FF20DF609E268 Path : /etc/apt/sources.list
Example 2: Compute the hash value for a file
Example 3: Compute the hash value for an ISO file
This example uses the Get-FileHash
cmdlet and the SHA384 algorithm to compute the hash value for an ISO file that an administrator has downloaded from the internet. The output is piped to the Format-List
cmdlet to format the output as a list.
Get-FileHash C:\Users\user1\Downloads\Contoso8_1_ENT.iso -Algorithm SHA384 | Format-List Algorithm : SHA384 Hash : 20AB1C2EE19FC96A7C66E33917D191A24E3CE9DAC99DB7C786ACCE31E559144FEAFC695C58E508E2EBBC9D3C96F21FA3 Path : C:\Users\user1\Downloads\Contoso8_1_ENT.iso
Parameters
-Algorithm
Specifies the cryptographic hash function to use for computing the hash value of the contents of the specified file or stream. A cryptographic hash function has the property that it is infeasible to find two different files with the same hash value. Hash functions are commonly used with digital signatures and for data integrity. The acceptable values for this parameter are:
- SHA1
- SHA256
- SHA384
- SHA512
- MD5
อ่านเพิ่มเติม:
No comments:
Post a Comment