format('Ymd') : $dob; } // Fallback $ts = strtotime($dob); return $ts ? date('Ymd', $ts) : $dob; } /** * Create a stable consumer profile ID from DOB + SSN. * Returns first 32 chars of HMAC-SHA256. */ public static function createConsumerProfileId($dob, $ssn, $salt) { $normalized = self::normalizeDob($dob) . preg_replace('/[^0-9]/', '', $ssn); return substr(hash_hmac('sha256', $normalized, $salt), 0, 32); } }