This product is not supported for your selected Datadog site. ().
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Metadata

ID: php-security/avoid-sha224

Language: PHP

Severity: Warning

Category: Security

CWE: 328

Description

This rule discourages the use of the SHA224 hashing algorithm and its variants such as SHA512/224 and SHA3-224. These hash functions produce shorter digests that offer less collision resistance compared to stronger alternatives like SHA256 or SHA512. Using SHA224 can weaken the security of your application, making it more vulnerable to collision attacks and reducing overall cryptographic strength.

To ensure robust security, it is important to use more secure hash algorithms such as SHA256 or SHA3-256, which provide longer digests and better resistance against cryptographic attacks. When calling PHP’s hash or hash_hmac functions, specify these stronger algorithms explicitly, for example: hash('sha256', $content, $key);.

Non-Compliant Code Examples

<?
hash('sha224', $content, $key);
hash('sha512/224', $content, $key);
hash('sha3-224', $content, $key);
hash_hmac('sha224', $content, $key);
hash_hmac('sha512/224', $content, $key);
hash_hmac('sha3-224', $content, $key);
hash_hmac("sha3-224", $content, $key);
?>

Compliant Code Examples

<?
hash('sha256', $content, $key);
?>
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

シームレスな統合。 Datadog Code Security をお試しください