21 $cur_counter =
array( 0, 0, 0, 0, 0, 0, 0, 0 );
22 for ( $i = 7; $i >= 0; $i-- ) {
23 $cur_counter[$i] = pack(
'C*', $counter );
24 $counter = $counter >> 8;
27 $bin_counter = implode( $cur_counter );
30 if ( strlen( $bin_counter ) < 8 ) {
31 $bin_counter = str_repeat(
"\0", 8 - strlen( $bin_counter ) ) . $bin_counter;
35 $hash = hash_hmac(
'sha1', $bin_counter, $key );
50 if ( !$timestamp && $timestamp !== 0 ) {
54 $counter = (int)( $timestamp / $window );
73 $max = 1, $timestamp =
false
75 if ( !$timestamp && $timestamp !== 0 ) {
79 $counter = (int)( $timestamp / $window );
80 $window = range( $min, $max );
83 $length = count( $window );
84 for ( $i = 0; $i < $length; $i++ ) {
85 $shift_counter = $counter + $window[$i];
123 $hmac_result =
array();
126 foreach ( str_split( $this->hash, 2 ) as
$hex ) {
127 $hmac_result[] = hexdec(
$hex);
130 $offset = $hmac_result[19] & 0xf;
133 ( ( $hmac_result[$offset+0] & 0x7f ) << 24 ) |
134 ( ( $hmac_result[$offset+1] & 0xff ) << 16 ) |
135 ( ( $hmac_result[$offset+2] & 0xff ) << 8 ) |
136 ( $hmac_result[$offset+3] & 0xff )
140 $this->hex = dechex( $this->decimal );
173 $str = str_pad( $this->
toDec(), $length,
"0", STR_PAD_LEFT );
174 $str = substr( $str, ( -1 * $length ) );
The HOTPResult Class converts an HOTP item to various forms Supported formats include hex,...
toString()
Returns the string version of the HOTP.
toDec()
Returns the decimal version of the HOTP.
toHOTP( $length)
Returns the truncated decimal form of the HOTP.
toHex()
Returns the hex version of the HOTP.
__construct( $value)
Build an HOTP Result.
HOTP Class Based on the work of OAuth, and the sample implementation of HMAC OTP http://tools....
static generateByTime( $key, $window, $timestamp=false)
Generate a HOTP key based on a timestamp and window size.
static generateByTimeWindow( $key, $window, $min=-1, $max=1, $timestamp=false)
Generate a HOTP key collection based on a timestamp and window size all keys that could exist between...
static getTime()
Gets the current time Ensures we are operating in UTC for the entire framework Restores the timezone ...
static generateByCounter( $key, $counter)
Generate a HOTP key based on a counter value (event based HOTP)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))