Automattic\WooCommerce\Internal\Email\Unsubscribes
Storage::hash_email
Hash a raw email address for use as the lookup key.
Normalizes (trim + strtolower) before hashing so equivalent addresses collide on the same row. Returns an empty string for empty input so callers can early-out without raising.
Method of the class: Storage{}
No Hooks.
Returns
string. 64-char hex SHA-256 hash, or '' if input was empty.
Usage
$result = Storage::hash_email( $email ): string;
- $email(string) (required)
- Raw email address.
Storage::hash_email() Storage::hash email code WC 11.1.2
public static function hash_email( string $email ): string {
$normalized = strtolower( trim( $email ) );
if ( '' === $normalized ) {
return '';
}
return hash( 'sha256', $normalized );
}