62 $suffixLen = strlen( self::SUFFIX );
63 $len = strlen( $token );
64 if ( $len <= 32 + $suffixLen ||
65 substr( $token, -$suffixLen ) !== self::SUFFIX ||
66 strspn( $token,
'0123456789abcdef' ) + $suffixLen !== $len
71 return hexdec( substr( $token, 32, -$suffixLen ) );
80 return hash_hmac(
'md5', $timestamp . $this->salt, $this->secret,
false ) .
81 dechex( $timestamp ) .
103 public function match( $userToken, $maxAge =
null ) {
105 if ( $timestamp ===
null ) {
108 if ( $maxAge !==
null && $timestamp <
wfTimestamp() - $maxAge ) {
114 return hash_equals( $sessionToken, $userToken );
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.