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 ) {
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();
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 ) );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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))