Skip to content

Files

Latest commit

 

History

History
44 lines (27 loc) · 897 Bytes

AvoidUsingBrokenHashAlgorithms.md

File metadata and controls

44 lines (27 loc) · 897 Bytes

Pattern: Use of broken hash algorith

Issue: -

Description

Avoid using the broken algorithms MD5 or SHA-1.

How

Replace broken algorithms with secure alternatives. MD5 and SHA-1 should be replaced with SHA256, SHA384, SHA512, or other safer algorithms when possible, with MD5 and SHA-1 only being utilized by necessity for backwards compatibility.

Example 1

Example of incorrect code:

Get-FileHash foo.txt -Algorithm MD5

Example of correct code:

Get-FileHash foo.txt -Algorithm SHA256

Example 2

Example of incorrect code:

Get-FileHash foo.txt -Algorithm SHA1

Example of correct code:

Get-FileHash foo.txt

Further Reading