윈도우

PowerShell로 해쉬값 계산

 

1. -algorithm 옵션 목록 (SHA1, SHA256, SHA384, SHA512, MD5)
2. Format-List 옵션은 속성마다 줄바꿈해서 보기좋게 나오게 함 (기본값은 한 줄로 나옴)
3. 경로에 와일드 카드 지원함.
4. MD5와 SHA1 은 안전하지 않음.
5. 실행에서 powershell 입력.

 


# SHA256 계산 (-algorithm 옵션이 생략되면 기본값으로 SHA256)

PS C:\> Get-FileHash $pshome\powershell.exe | Format-List
Algorithm : SHA256
Hash : 6A785ADC0263238DAB3EB37F4C185C8FBA7FEB5D425D034CA9864F1BE1C1B473
Path : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

 


# SHA384 계산

PS C:\> Get-FileHash C:\Users\Andris\Downloads\Contoso8_1_ENT.iso -Algorithm SHA384 | Format-List

Algorithm : SHA384
Hash : 20AB1C2EE19FC96A7C66E33917D191A24E3CE9DAC99DB7C786ACCE31E559144FEAFC695C58E508E2EBBC9D3C96F21FA3
Path : C:\Users\Andris\Downloads\Contoso8_1_ENT.iso

 


# 확장자가 iso 인 모든 파일 SHA384 계산 (와일드 카드 사용)

PS C:\> Get-FileHash C:\Users\Andris\Downloads\*.iso -Algorithm SHA384 | Format-List

 


# 여러개의 파일 지정해서 SHA384 계산 (파일은 컴마(,)로 구분, 경로에 큰 따옴표 가능)

PS C:\> Get-FileHash C:\Downloads\aaa.iso, C:\Downloads\bbb.iso, “C:\Downloads\ccc.iso” -Algorithm SHA384 | Format-List

 

 

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-6

 

Related posts

Leave a Comment