+ Hash functions that are not sufficiently computationally hard can leave data vulnerable. You should not use such functions for password hashing. +
+ ++ A strong cryptographic hash function should be resistant to: +
+h(x),
+ you should not be able to easily find the input x.
+ h(x),
+ you should not be able to easily find a different input
+ y
+ with the same hash value h(x) = h(y).
+ h(x),
+ you should not be able to find an input y that computes to that hash value
+ using brute force attacks without significant computational effort.
+ + All of MD5, SHA-1, SHA-2 and SHA-3 are weak against offline brute forcing, since they are not sufficiently computationally hard. This includes SHA-224, SHA-256, SHA-384 and SHA-512, which are in the SHA-2 family. +
+ ++ Password hashing algorithms should be slow and/or memory intensive to compute, to make brute force attacks more difficult. +
+ ++ For password storage, you should use a sufficiently computationally hard cryptographic hash function, such as one of the following: +
+ ++ The following examples show two versions of the same function. In both cases, a password is hashed using a cryptographic hashing algorithm. + + In the first case, the SHA-512 hashing algorithm is used. It is vulnerable to offline brute force attacks: +
++ + Here is the same function using Argon2, which is suitable for password hashing: +
++ Using a broken or weak cryptographic hash function can leave data + vulnerable, and should not be used in security related code. +
+ ++ A strong cryptographic hash function should be resistant to: +
+h(x),
+ you should not be able to easily find the input x.
+ h(x),
+ you should not be able to easily find a different input
+ y
+ with the same hash value h(x) = h(y).
+ + As an example, both MD5 and SHA-1 are known to be vulnerable to collision attacks. +
+ ++ Since it's OK to use a weak cryptographic hash function in a non-security + context, this query only alerts when these are used to hash sensitive + data (such as passwords, certificates, usernames). +
+ ++ Ensure that you use a strong, modern cryptographic hash function, such as: +
+ ++ Note that special purpose algorithms, which are used to ensure that a message comes from a particular sender, exist for message authentication. These algorithms should be used when appropriate, as they address common vulnerabilities of simple hashing schemes in this context. +
+ ++ The following examples show a function for fetching data from a + URL along with a hash of the data, perhaps to check the data has + not been tampered with. +
+ ++ In the first case the MD5 hashing algorithm is used that is known to be vulnerable to collision attacks. +
++ Here is the same function using SHA-512, which is a strong cryptographic hashing function. +
+Since it's OK to use a weak cryptographic hash function in a non-security context, this query only alerts when these are used to hash sensitive - data (such as passwords, certificates, usernames). + data (such as usernames, identifying information and private data).
@@ -60,7 +60,7 @@The following examples show a function for fetching data from a - URL along with a hash of the data, perhaps to check the data has + URL and computing a hash of the data, perhaps to check the data has not been tampered with.