Make WordPress Core


Ignore:
Timestamp:
03/03/2025 09:49:36 AM (5 months ago)
Author:
johnbillion
Message:

Security: Reduce the length of the hash returned by wp_fast_hash() so it can be used in the user_activation_key field when a legacy database schema is still in use.

This reduces the hash length from 32 bytes to 30 so the overall length of an activation key after encoding, prefixing, and prepending a timestamp fits into 60 bytes.

A key is also introduced for domain separation. This doesn't affect the output length.

Props dd32, paragoninitiativeenterprises, peterwilsoncc, johnbillion

Fixes #21022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r59830 r59904  
    91439143    string $message
    91449144): string {
    9145     return '$generic$' . sodium_bin2hex( sodium_crypto_generichash( $message ) );
     9145    $hashed = sodium_crypto_generichash( $message, 'wp_fast_hash_6.8+', 30 );
     9146    return '$generic$' . sodium_bin2base64( $hashed, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING );
    91469147}
    91479148
Note: See TracChangeset for help on using the changeset viewer.