Completed
Push — master ( e355ed...1c7137 )
by Michiel
01:02 queued 11s
created
library/tiqr/Tiqr/OATH/OCRAWrapper_v1.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
     {
108 108
         // find the :QN10, -QN10, QH10 etc. bit
109 109
         $pos = stripos($ocraSuite, ":q");
110
-        if ($pos===false) $pos = stripos($ocraSuite, "-q");
111
-        if ($pos===false) {
110
+        if ($pos === false) $pos = stripos($ocraSuite, "-q");
111
+        if ($pos === false) {
112 112
             // No challenge config specified. Since we only support challenge based OCRA, we fallback to default 10 digit hexadecimal.
113 113
             return array("format"=>"H", "length"=>10);
114 114
         }
115
-        $format = substr($ocraSuite, $pos+2, 1);
115
+        $format = substr($ocraSuite, $pos + 2, 1);
116 116
         if (!in_array($format, array("N", "A", "H"))) {
117 117
             $format = "H";
118 118
         }
119 119
         
120
-        $length = (int)substr($ocraSuite, $pos+3, 2);
120
+        $length = (int) substr($ocraSuite, $pos + 3, 2);
121 121
                 
122
-        if ($length<=0) {
122
+        if ($length <= 0) {
123 123
             $length = 10;
124 124
         }
125 125
         
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     protected function _calculateResponse($ocraSuite, $secret, $challenge, $sessionKey)
192 192
     {       
193
-        if (strpos(strtolower($ocraSuite), "qn")!==false) {
193
+        if (strpos(strtolower($ocraSuite), "qn") !== false) {
194 194
             
195 195
             // challenge is decimal, but generateOcra always wants it in hex.
196 196
             $challenge = dechex($challenge);
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/HOTP.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
      * @param String $counter
47 47
      * @return String hash
48 48
      */
49
-    protected function _getHash ($secret, $counter)
49
+    protected function _getHash($secret, $counter)
50 50
     {
51 51
          // Counter
52 52
          //the counter value can be more than one byte long, so we need to go multiple times
53
-         $cur_counter = array(0,0,0,0,0,0,0,0);
54
-         for($i=7;$i>=0;$i--)
53
+         $cur_counter = array(0, 0, 0, 0, 0, 0, 0, 0);
54
+         for ($i = 7; $i >= 0; $i--)
55 55
          {
56
-             $cur_counter[$i] = pack ('C*', $counter);
56
+             $cur_counter[$i] = pack('C*', $counter);
57 57
              $counter = $counter >> 8;
58 58
          }
59 59
          $bin_counter = implode($cur_counter);
60 60
          // Pad to 8 chars
61
-         if (strlen ($bin_counter) < 8)
61
+         if (strlen($bin_counter) < 8)
62 62
          {
63
-             $bin_counter = str_repeat (chr(0), 8 - strlen ($bin_counter)) . $bin_counter;
63
+             $bin_counter = str_repeat(chr(0), 8 - strlen($bin_counter)).$bin_counter;
64 64
          }
65 65
      
66 66
          // HMAC
67
-         $hash = hash_hmac ('sha1', $bin_counter, $secret);
67
+         $hash = hash_hmac('sha1', $bin_counter, $secret);
68 68
          return $hash;
69 69
     }
70 70
  
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     protected function _truncate($hash, $length = 6)
78 78
     {
79 79
          // Convert to dec
80
-         foreach(str_split($hash,2) as $hex)
80
+         foreach (str_split($hash, 2) as $hex)
81 81
          {
82
-             $hmac_result[]=hexdec($hex);
82
+             $hmac_result[] = hexdec($hex);
83 83
          }
84 84
      
85 85
          // Find offset
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
          // Algorithm from RFC
89 89
          return
90 90
          (
91
-             (($hmac_result[$offset+0] & 0x7f) << 24 ) |
92
-             (($hmac_result[$offset+1] & 0xff) << 16 ) |
93
-             (($hmac_result[$offset+2] & 0xff) << 8 ) |
94
-             ($hmac_result[$offset+3] & 0xff)
95
-         ) % pow(10,$length);
91
+             (($hmac_result[$offset + 0] & 0x7f) << 24) |
92
+             (($hmac_result[$offset + 1] & 0xff) << 16) |
93
+             (($hmac_result[$offset + 2] & 0xff) << 8) |
94
+             ($hmac_result[$offset + 3] & 0xff)
95
+         ) % pow(10, $length);
96 96
     }
97 97
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/OCRA_v1.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             $keyBytes,
47 47
             $text)
48 48
     {
49
-         $hash = hash_hmac ($crypto, $text, $keyBytes);
49
+         $hash = hash_hmac($crypto, $text, $keyBytes);
50 50
          return $hash;
51 51
     }
52 52
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return String a string with raw bytes
59 59
      */
60
-    private static function _hexStr2Bytes($hex){
60
+    private static function _hexStr2Bytes($hex) {
61 61
         return pack("H*", $hex);
62 62
     }
63 63
 
@@ -101,63 +101,63 @@  discard block
 block discarded – undo
101 101
         $sessionInformationLength = 0;
102 102
         $timeStampLength = 0;
103 103
 
104
-        if(stripos($ocraSuite, "sha1")!==false)
104
+        if (stripos($ocraSuite, "sha1") !== false)
105 105
             $crypto = "sha1";
106
-        if(stripos($ocraSuite, "sha256")!==false)
106
+        if (stripos($ocraSuite, "sha256") !== false)
107 107
             $crypto = "sha256";
108
-        if(stripos($ocraSuite, "sha512")!==false)
108
+        if (stripos($ocraSuite, "sha512") !== false)
109 109
             $crypto = "sha512";
110 110
 
111 111
         // How many digits should we return
112
-        $oS = substr($ocraSuite, strpos($ocraSuite, ":")+1, strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1) -strpos($ocraSuite, ":")-1);
113
-        $codeDigits = substr($oS, strrpos($oS, "-")+1);
112
+        $oS = substr($ocraSuite, strpos($ocraSuite, ":") + 1, strpos($ocraSuite, ":", strpos($ocraSuite, ":") + 1) - strpos($ocraSuite, ":") - 1);
113
+        $codeDigits = substr($oS, strrpos($oS, "-") + 1);
114 114
         
115 115
         // The size of the byte array message to be encrypted
116 116
         // Counter
117
-        if(stripos($ocraSuite, ":c") !==false) {
117
+        if (stripos($ocraSuite, ":c") !== false) {
118 118
             // Fix the length of the HEX string
119
-            while(strlen($counter) < 16)
120
-                $counter = "0" . $counter;
121
-            $counterLength=8;
119
+            while (strlen($counter) < 16)
120
+                $counter = "0".$counter;
121
+            $counterLength = 8;
122 122
         }
123 123
         // Question
124
-        if(stripos($ocraSuite, ":q")!==false ||
125
-                stripos($ocraSuite, "-q")!==false) {
126
-            while(strlen($question) < 256)
127
-                $question = $question . "0";
128
-            $questionLength=128;
124
+        if (stripos($ocraSuite, ":q") !== false ||
125
+                stripos($ocraSuite, "-q") !== false) {
126
+            while (strlen($question) < 256)
127
+                $question = $question."0";
128
+            $questionLength = 128;
129 129
         }
130 130
 
131 131
         // Password
132
-        if(stripos($ocraSuite, ":p")!==false ||
133
-                stripos($ocraSuite, "-p") !==false) {
134
-            while(strlen($password) < 40)
135
-                $password = "0" . $password;
136
-            $passwordLength=20;
132
+        if (stripos($ocraSuite, ":p") !== false ||
133
+                stripos($ocraSuite, "-p") !== false) {
134
+            while (strlen($password) < 40)
135
+                $password = "0".$password;
136
+            $passwordLength = 20;
137 137
         }
138 138
 
139 139
         // sessionInformation
140
-        if(stripos($ocraSuite, ":s") !==false ||
141
-                stripos($ocraSuite, "-s", strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1)) !== false) {
142
-            while(strlen($sessionInformation) < 128)
143
-                $sessionInformation = "0" . $sessionInformation;
140
+        if (stripos($ocraSuite, ":s") !== false ||
141
+                stripos($ocraSuite, "-s", strpos($ocraSuite, ":", strpos($ocraSuite, ":") + 1)) !== false) {
142
+            while (strlen($sessionInformation) < 128)
143
+                $sessionInformation = "0".$sessionInformation;
144 144
 
145
-            $sessionInformationLength=64;
145
+            $sessionInformationLength = 64;
146 146
         }
147 147
              
148 148
         // TimeStamp
149
-        if(stripos($ocraSuite, ":t") !==false ||
149
+        if (stripos($ocraSuite, ":t") !== false ||
150 150
                 stripos($ocraSuite, "-t") !== false) {
151
-            while(strlen($timeStamp) < 16)
152
-                $timeStamp = "0" . $timeStamp;
153
-            $timeStampLength=8;
151
+            while (strlen($timeStamp) < 16)
152
+                $timeStamp = "0".$timeStamp;
153
+            $timeStampLength = 8;
154 154
         }
155 155
 
156 156
         // Put the bytes of "ocraSuite" parameters into the message
157 157
         
158
-        $msg = array_fill(0,$ocraSuiteLength+$counterLength+$questionLength+$passwordLength+$sessionInformationLength+$timeStampLength+1, 0);
158
+        $msg = array_fill(0, $ocraSuiteLength + $counterLength + $questionLength + $passwordLength + $sessionInformationLength + $timeStampLength + 1, 0);
159 159
                 
160
-        for($i=0;$i<strlen($ocraSuite);$i++) {
160
+        for ($i = 0; $i < strlen($ocraSuite); $i++) {
161 161
             $msg[$i] = $ocraSuite[$i];
162 162
         }
163 163
         
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 
167 167
         // Put the bytes of "Counter" to the message
168 168
         // Input is HEX encoded
169
-        if($counterLength > 0 ) {
169
+        if ($counterLength > 0) {
170 170
             $bArray = self::_hexStr2Bytes($counter);
171
-            for ($i=0;$i<strlen($bArray);$i++) {
171
+            for ($i = 0; $i < strlen($bArray); $i++) {
172 172
                 $msg [$i + $ocraSuiteLength + 1] = $bArray[$i];
173 173
             }
174 174
         }
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 
177 177
         // Put the bytes of "question" to the message
178 178
         // Input is text encoded
179
-        if($questionLength > 0 ) {
179
+        if ($questionLength > 0) {
180 180
             $bArray = self::_hexStr2Bytes($question);
181
-            for ($i=0;$i<strlen($bArray);$i++) {
181
+            for ($i = 0; $i < strlen($bArray); $i++) {
182 182
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength] = $bArray[$i];
183 183
             }
184 184
         }
185 185
 
186 186
         // Put the bytes of "password" to the message
187 187
         // Input is HEX encoded
188
-        if($passwordLength > 0){
188
+        if ($passwordLength > 0) {
189 189
             $bArray = self::_hexStr2Bytes($password);
190
-            for ($i=0;$i<strlen($bArray);$i++) {
190
+            for ($i = 0; $i < strlen($bArray); $i++) {
191 191
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength] = $bArray[$i];
192 192
             }
193 193
         }
194 194
 
195 195
         // Put the bytes of "sessionInformation" to the message
196 196
         // Input is text encoded
197
-        if($sessionInformationLength > 0 ){
197
+        if ($sessionInformationLength > 0) {
198 198
             $bArray = self::_hexStr2Bytes($sessionInformation);
199
-            for ($i=0;$i<strlen($bArray);$i++) {
199
+            for ($i = 0; $i < strlen($bArray); $i++) {
200 200
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength] = $bArray[$i];
201 201
             }
202 202
         }
203 203
 
204 204
         // Put the bytes of "time" to the message
205 205
         // Input is text value of minutes
206
-        if($timeStampLength > 0){
206
+        if ($timeStampLength > 0) {
207 207
             $bArray = self::_hexStr2Bytes($timestamp);
208
-            for ($i=0;$i<strlen($bArray);$i++) {
208
+            for ($i = 0; $i < strlen($bArray); $i++) {
209 209
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength + $sessionInformationLength] = $bArray[$i];
210 210
             }
211 211
         }
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
     function _oath_truncate($hash, $length = 6)
228 228
     {
229 229
         // Convert to dec
230
-        foreach(str_split($hash,2) as $hex)
230
+        foreach (str_split($hash, 2) as $hex)
231 231
         {
232
-            $hmac_result[]=hexdec($hex);
232
+            $hmac_result[] = hexdec($hex);
233 233
         }
234 234
     
235 235
         // Find offset
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
         // Algorithm from RFC
239 239
         return
240 240
         (
241
-            (($hmac_result[$offset+0] & 0x7f) << 24 ) |
242
-            (($hmac_result[$offset+1] & 0xff) << 16 ) |
243
-            (($hmac_result[$offset+2] & 0xff) << 8 ) |
244
-            ($hmac_result[$offset+3] & 0xff)
245
-        ) % pow(10,$length);
241
+            (($hmac_result[$offset + 0] & 0x7f) << 24) |
242
+            (($hmac_result[$offset + 1] & 0xff) << 16) |
243
+            (($hmac_result[$offset + 2] & 0xff) << 8) |
244
+            ($hmac_result[$offset + 3] & 0xff)
245
+        ) % pow(10, $length);
246 246
     }
247 247
     
248 248
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/OCRA.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $keyBytes,
38 38
             $text)
39 39
     {
40
-         $hash = hash_hmac ($crypto, $text, $keyBytes);
40
+         $hash = hash_hmac($crypto, $text, $keyBytes);
41 41
          return $hash;
42 42
     }
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return String a string with raw bytes
50 50
      */
51
-    private static function _hexStr2Bytes($hex){
51
+    private static function _hexStr2Bytes($hex) {
52 52
         return pack("H*", $hex);
53 53
     }
54 54
 
@@ -97,95 +97,95 @@  discard block
 block discarded – undo
97 97
         $cryptoFunction = $components[1];
98 98
         $dataInput = strtolower($components[2]); // lower here so we can do case insensitive comparisons
99 99
         
100
-        if(stripos($cryptoFunction, "sha1")!==false)
100
+        if (stripos($cryptoFunction, "sha1") !== false)
101 101
             $crypto = "sha1";
102
-        if(stripos($cryptoFunction, "sha256")!==false)
102
+        if (stripos($cryptoFunction, "sha256") !== false)
103 103
             $crypto = "sha256";
104
-        if(stripos($cryptoFunction, "sha512")!==false)
104
+        if (stripos($cryptoFunction, "sha512") !== false)
105 105
             $crypto = "sha512";
106 106
         
107
-        $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-")+1);
107
+        $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-") + 1);
108 108
                 
109 109
         // The size of the byte array message to be encrypted
110 110
         // Counter
111
-        if($dataInput[0] == "c" ) {
111
+        if ($dataInput[0] == "c") {
112 112
             // Fix the length of the HEX string
113
-            while(strlen($counter) < 16)
114
-                $counter = "0" . $counter;
115
-            $counterLength=8;
113
+            while (strlen($counter) < 16)
114
+                $counter = "0".$counter;
115
+            $counterLength = 8;
116 116
         }
117 117
         // Question
118
-        if($dataInput[0] == "q" ||
119
-                stripos($dataInput, "-q")!==false) {
120
-            while(strlen($question) < 256)
121
-                $question = $question . "0";
122
-            $questionLength=128;
118
+        if ($dataInput[0] == "q" ||
119
+                stripos($dataInput, "-q") !== false) {
120
+            while (strlen($question) < 256)
121
+                $question = $question."0";
122
+            $questionLength = 128;
123 123
         }
124 124
 
125 125
         // Password
126
-        if(stripos($dataInput, "psha1")!==false) {
127
-            while(strlen($password) < 40)
128
-                $password = "0" . $password;
129
-            $passwordLength=20;
126
+        if (stripos($dataInput, "psha1") !== false) {
127
+            while (strlen($password) < 40)
128
+                $password = "0".$password;
129
+            $passwordLength = 20;
130 130
         }
131 131
     
132
-        if(stripos($dataInput, "psha256")!==false) {
133
-            while(strlen($password) < 64)
134
-                $password = "0" . $password;
135
-            $passwordLength=32;
132
+        if (stripos($dataInput, "psha256") !== false) {
133
+            while (strlen($password) < 64)
134
+                $password = "0".$password;
135
+            $passwordLength = 32;
136 136
         }
137 137
         
138
-        if(stripos($dataInput, "psha512")!==false) {
139
-            while(strlen($password) < 128)
140
-                $password = "0" . $password;
141
-            $passwordLength=64;
138
+        if (stripos($dataInput, "psha512") !== false) {
139
+            while (strlen($password) < 128)
140
+                $password = "0".$password;
141
+            $passwordLength = 64;
142 142
         }
143 143
         
144 144
         // sessionInformation
145
-        if(stripos($dataInput, "s064") !==false) {
146
-            while(strlen($sessionInformation) < 128)
147
-                $sessionInformation = "0" . $sessionInformation;
145
+        if (stripos($dataInput, "s064") !== false) {
146
+            while (strlen($sessionInformation) < 128)
147
+                $sessionInformation = "0".$sessionInformation;
148 148
 
149
-            $sessionInformationLength=64;
150
-        } else if(stripos($dataInput, "s128") !==false) {
151
-            while(strlen($sessionInformation) < 256)
152
-                $sessionInformation = "0" . $sessionInformation;
149
+            $sessionInformationLength = 64;
150
+        } else if (stripos($dataInput, "s128") !== false) {
151
+            while (strlen($sessionInformation) < 256)
152
+                $sessionInformation = "0".$sessionInformation;
153 153
         
154
-            $sessionInformationLength=128;
155
-        } else if(stripos($dataInput, "s256") !==false) {
156
-            while(strlen($sessionInformation) < 512)
157
-                $sessionInformation = "0" . $sessionInformation;
154
+            $sessionInformationLength = 128;
155
+        } else if (stripos($dataInput, "s256") !== false) {
156
+            while (strlen($sessionInformation) < 512)
157
+                $sessionInformation = "0".$sessionInformation;
158 158
         
159
-            $sessionInformationLength=256;
160
-        } else if(stripos($dataInput, "s512") !==false) {
161
-            while(strlen($sessionInformation) < 128)
162
-                $sessionInformation = "0" . $sessionInformation;
159
+            $sessionInformationLength = 256;
160
+        } else if (stripos($dataInput, "s512") !== false) {
161
+            while (strlen($sessionInformation) < 128)
162
+                $sessionInformation = "0".$sessionInformation;
163 163
         
164
-            $sessionInformationLength=64;
165
-        } else if (stripos($dataInput, "s") !== false ) {
164
+            $sessionInformationLength = 64;
165
+        } else if (stripos($dataInput, "s") !== false) {
166 166
             // deviation from spec. Officially 's' without a length indicator is not in the reference implementation.
167 167
             // RFC is ambigious. However we have supported this in Tiqr since day 1, so we continue to support it.
168
-            while(strlen($sessionInformation) < 128)
169
-                $sessionInformation = "0" . $sessionInformation;
168
+            while (strlen($sessionInformation) < 128)
169
+                $sessionInformation = "0".$sessionInformation;
170 170
             
171
-            $sessionInformationLength=64;
171
+            $sessionInformationLength = 64;
172 172
         }
173 173
         
174 174
         
175 175
              
176 176
         // TimeStamp
177
-        if($dataInput[0] == "t" ||
177
+        if ($dataInput[0] == "t" ||
178 178
                 stripos($dataInput, "-t") !== false) {
179
-            while(strlen($timeStamp) < 16)
180
-                $timeStamp = "0" . $timeStamp;
181
-            $timeStampLength=8;
179
+            while (strlen($timeStamp) < 16)
180
+                $timeStamp = "0".$timeStamp;
181
+            $timeStampLength = 8;
182 182
         }
183 183
 
184 184
         // Put the bytes of "ocraSuite" parameters into the message
185 185
         
186
-        $msg = array_fill(0,$ocraSuiteLength+$counterLength+$questionLength+$passwordLength+$sessionInformationLength+$timeStampLength+1, 0);
186
+        $msg = array_fill(0, $ocraSuiteLength + $counterLength + $questionLength + $passwordLength + $sessionInformationLength + $timeStampLength + 1, 0);
187 187
                 
188
-        for($i=0;$i<strlen($ocraSuite);$i++) {
188
+        for ($i = 0; $i < strlen($ocraSuite); $i++) {
189 189
             $msg[$i] = $ocraSuite[$i];
190 190
         }
191 191
         
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
         // Put the bytes of "Counter" to the message
196 196
         // Input is HEX encoded
197
-        if($counterLength > 0 ) {
197
+        if ($counterLength > 0) {
198 198
             $bArray = self::_hexStr2Bytes($counter);
199
-            for ($i=0;$i<strlen($bArray);$i++) {
199
+            for ($i = 0; $i < strlen($bArray); $i++) {
200 200
                 $msg [$i + $ocraSuiteLength + 1] = $bArray[$i];
201 201
             }
202 202
         }
@@ -204,36 +204,36 @@  discard block
 block discarded – undo
204 204
 
205 205
         // Put the bytes of "question" to the message
206 206
         // Input is text encoded
207
-        if($questionLength > 0 ) {
207
+        if ($questionLength > 0) {
208 208
             $bArray = self::_hexStr2Bytes($question);
209
-            for ($i=0;$i<strlen($bArray);$i++) {
209
+            for ($i = 0; $i < strlen($bArray); $i++) {
210 210
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength] = $bArray[$i];
211 211
             }
212 212
         }
213 213
 
214 214
         // Put the bytes of "password" to the message
215 215
         // Input is HEX encoded
216
-        if($passwordLength > 0){
216
+        if ($passwordLength > 0) {
217 217
             $bArray = self::_hexStr2Bytes($password);
218
-            for ($i=0;$i<strlen($bArray);$i++) {
218
+            for ($i = 0; $i < strlen($bArray); $i++) {
219 219
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength] = $bArray[$i];
220 220
             }
221 221
         }
222 222
 
223 223
         // Put the bytes of "sessionInformation" to the message
224 224
         // Input is text encoded
225
-        if($sessionInformationLength > 0 ){
225
+        if ($sessionInformationLength > 0) {
226 226
             $bArray = self::_hexStr2Bytes($sessionInformation);
227
-            for ($i=0;$i<strlen($bArray);$i++) {
227
+            for ($i = 0; $i < strlen($bArray); $i++) {
228 228
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength] = $bArray[$i];
229 229
             }
230 230
         }
231 231
 
232 232
         // Put the bytes of "time" to the message
233 233
         // Input is text value of minutes
234
-        if($timeStampLength > 0){
234
+        if ($timeStampLength > 0) {
235 235
             $bArray = self::_hexStr2Bytes($timeStamp);
236
-            for ($i=0;$i<strlen($bArray);$i++) {
236
+            for ($i = 0; $i < strlen($bArray); $i++) {
237 237
                 $msg [$i + $ocraSuiteLength + 1 + $counterLength + $questionLength + $passwordLength + $sessionInformationLength] = $bArray[$i];
238 238
             }
239 239
         }
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
     static function _oath_truncate($hash, $length = 6)
256 256
     {
257 257
         // Convert to dec
258
-        foreach(str_split($hash,2) as $hex)
258
+        foreach (str_split($hash, 2) as $hex)
259 259
         {
260
-            $hmac_result[]=hexdec($hex);
260
+            $hmac_result[] = hexdec($hex);
261 261
         }
262 262
     
263 263
         // Find offset
264 264
         $offset = $hmac_result[count($hmac_result) - 1] & 0xf;
265 265
     
266 266
         $v = strval(
267
-            (($hmac_result[$offset+0] & 0x7f) << 24 ) |
268
-            (($hmac_result[$offset+1] & 0xff) << 16 ) |
269
-            (($hmac_result[$offset+2] & 0xff) << 8 ) |
270
-            ($hmac_result[$offset+3] & 0xff)
267
+            (($hmac_result[$offset + 0] & 0x7f) << 24) |
268
+            (($hmac_result[$offset + 1] & 0xff) << 16) |
269
+            (($hmac_result[$offset + 2] & 0xff) << 8) |
270
+            ($hmac_result[$offset + 3] & 0xff)
271 271
         );	
272 272
         
273 273
         $v = substr($v, strlen($v) - $length);
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/Exception/MismatchSenderId.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * @param boolean   $temporary  temporary failure?
36 36
      * @param Exception $parent     parent exception
37 37
      */
38
-    public function __construct($message, $temporary=false, Exception $parent=null)
38
+    public function __construct($message, $temporary = false, Exception $parent = null)
39 39
     {
40 40
         parent::__construct($message, $parent);
41 41
         $this->_temporary = $temporary;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/GCM.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
         }
103 103
 
104 104
         if ($error != null) {
105
-            throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: " . $error, true);
105
+            throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: ".$error, true);
106 106
         }
107 107
 
108 108
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * @param string    $message    exception message
30 30
      * @param Exception $parent     parent exception
31 31
      */
32
-     public function __construct($message, $parent=null)
32
+     public function __construct($message, $parent = null)
33 33
      {
34 34
          parent::__construct($message, 0, $parent);
35 35
      }
Please login to merge, or discard this patch.
library/tiqr/OATH/OCRAParser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	private function parseOCRASuite($ocraSuite) {
43 43
 		if (!is_string($ocraSuite)) {
44
-			throw new Exception('OCRASuite not in string format: ' . var_export($ocraSuite, TRUE));
44
+			throw new Exception('OCRASuite not in string format: '.var_export($ocraSuite, TRUE));
45 45
 		}
46 46
 
47 47
 		$ocraSuite = strtoupper($ocraSuite);
@@ -49,54 +49,54 @@  discard block
 block discarded – undo
49 49
 
50 50
 		$s = explode(':', $ocraSuite);
51 51
 		if (count($s) != 3) {
52
-			throw new Exception('Invalid OCRASuite format: ' . var_export($ocraSuite, TRUE));
52
+			throw new Exception('Invalid OCRASuite format: '.var_export($ocraSuite, TRUE));
53 53
 		}
54 54
 
55 55
 		$algo = explode('-', $s[0]);
56 56
 		if (count($algo) != 2) {
57
-			throw new Exception('Invalid OCRA version: ' . var_export($s[0], TRUE));
57
+			throw new Exception('Invalid OCRA version: '.var_export($s[0], TRUE));
58 58
 		}
59 59
 
60 60
 		if ($algo[0] !== 'OCRA') {
61
-			throw new Exception('Unsupported OCRA algorithm: ' . var_export($algo[0], TRUE));
61
+			throw new Exception('Unsupported OCRA algorithm: '.var_export($algo[0], TRUE));
62 62
 		}
63 63
 
64 64
 		if ($algo[1] !== '1') {
65
-			throw new Exception('Unsupported OCRA version: ' . var_export($algo[1], TRUE));
65
+			throw new Exception('Unsupported OCRA version: '.var_export($algo[1], TRUE));
66 66
 		}
67 67
 		$this->OCRAVersion = $algo[1];
68 68
 
69 69
 		$cf = explode('-', $s[1]);
70 70
 		if (count($cf) != 3) {
71
-			throw new Exception('Invalid OCRA suite crypto function: ' . var_export($s[1], TRUE));
71
+			throw new Exception('Invalid OCRA suite crypto function: '.var_export($s[1], TRUE));
72 72
 		}
73 73
 
74 74
 		if ($cf[0] !== 'HOTP') {
75
-			throw new Exception('Unsupported OCRA suite crypto function: ' . var_export($cf[0], TRUE));
75
+			throw new Exception('Unsupported OCRA suite crypto function: '.var_export($cf[0], TRUE));
76 76
 		}
77 77
 		$this->CryptoFunctionType = $cf[0];
78 78
 
79 79
 		if (!array_key_exists($cf[1], $this->supportedHashFunctions)) {
80
-			throw new Exception('Unsupported hash function in OCRA suite crypto function: ' . var_export($cf[1], TRUE));
80
+			throw new Exception('Unsupported hash function in OCRA suite crypto function: '.var_export($cf[1], TRUE));
81 81
 		}
82 82
 		$this->CryptoFunctionHash = $cf[1];
83 83
 		$this->CryptoFunctionHashLength = $this->supportedHashFunctions[$cf[1]];
84 84
 
85 85
 		if (!preg_match('/^\d+$/', $cf[2]) || (($cf[2] < 4 || $cf[2] > 10) && $cf[2] != 0)) {
86
-			throw new Exception('Invalid OCRA suite crypto function truncation length: ' . var_export($cf[2], TRUE));
86
+			throw new Exception('Invalid OCRA suite crypto function truncation length: '.var_export($cf[2], TRUE));
87 87
 		}
88 88
 		$this->CryptoFunctionTruncation = intval($cf[2]);
89 89
 
90 90
 		$di = explode('-', $s[2]);
91 91
 		if (count($cf) == 0) {
92
-			throw new Exception('Invalid OCRA suite data input: ' . var_export($s[2], TRUE));
92
+			throw new Exception('Invalid OCRA suite data input: '.var_export($s[2], TRUE));
93 93
 		}
94 94
 
95 95
 		$data_input = array();
96
-		foreach($di as $elem) {
96
+		foreach ($di as $elem) {
97 97
 			$letter = $elem[0];
98 98
 			if (array_key_exists($letter, $data_input)) {
99
-				throw new Exception('Duplicate field in OCRA suite data input: ' . var_export($elem, TRUE));
99
+				throw new Exception('Duplicate field in OCRA suite data input: '.var_export($elem, TRUE));
100 100
 			}
101 101
 			$data_input[$letter] = 1;
102 102
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 				} elseif (preg_match('/^Q([AHN])(\d+)$/', $elem, $match)) {
109 109
 					$q_len = intval($match[2]);
110 110
 					if ($q_len < 4 || $q_len > 64) {
111
-						throw new Exception('Invalid OCRA suite data input question length: ' . var_export($q_len, TRUE));
111
+						throw new Exception('Invalid OCRA suite data input question length: '.var_export($q_len, TRUE));
112 112
 					}
113 113
 					$this->Q = TRUE;
114 114
 					$this->QType = $match[1];
115 115
 					$this->QLength = $q_len;
116 116
 				} else {
117
-					throw new Exception('Invalid OCRA suite data input question: ' . var_export($elem, TRUE));
117
+					throw new Exception('Invalid OCRA suite data input question: '.var_export($elem, TRUE));
118 118
 				}
119 119
 			} elseif ($letter === 'P') {
120 120
 				if (strlen($elem) == 1) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				} else {
123 123
 					$p_algo = substr($elem, 1);
124 124
 					if (!array_key_exists($p_algo, $this->supportedHashFunctions)) {
125
-						throw new Exception('Unsupported OCRA suite PIN hash function: ' . var_export($elem, TRUE));
125
+						throw new Exception('Unsupported OCRA suite PIN hash function: '.var_export($elem, TRUE));
126 126
 					}
127 127
 					$this->P = TRUE;
128 128
 					$this->PType = $p_algo;
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 				} elseif (preg_match('/^S(\d+)$/', $elem, $match)) {
135 135
 					$s_len = intval($match[1]);
136 136
 					if ($s_len <= 0 || $s_len > 512) {
137
-						throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($s_len, TRUE));
137
+						throw new Exception('Invalid OCRA suite data input session information length: '.var_export($s_len, TRUE));
138 138
 					}
139 139
 
140 140
 					$this->S = TRUE;
141 141
 					$this->SLength = $s_len;
142 142
 				} else {
143
-					throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($elem, TRUE));
143
+					throw new Exception('Invalid OCRA suite data input session information length: '.var_export($elem, TRUE));
144 144
 				}
145 145
 			} elseif ($letter === 'T') {
146 146
 				if (strlen($elem) == 1) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					preg_match_all('/(\d+)([HMS])/', $elem, $match);
150 150
 
151 151
 					if (count($match[1]) !== count(array_unique($match[2]))) {
152
-						throw new Exception('Duplicate definitions in OCRA suite data input timestamp: ' . var_export($elem, TRUE));
152
+						throw new Exception('Duplicate definitions in OCRA suite data input timestamp: '.var_export($elem, TRUE));
153 153
 					}
154 154
 
155 155
 					$length = 0;
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 						$length += intval($match[1][$i]) * $this->TPeriods[$match[2][$i]];
158 158
 					}
159 159
 					if ($length <= 0) {
160
-						throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
160
+						throw new Exception('Invalid OCRA suite data input timestamp: '.var_export($elem, TRUE));
161 161
 					}
162 162
 
163 163
 					$this->T = TRUE;
164 164
 					$this->TLength = $length;
165 165
 				} else {
166
-					throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
166
+					throw new Exception('Invalid OCRA suite data input timestamp: '.var_export($elem, TRUE));
167 167
 				}
168 168
 			} else {
169
-				throw new Exception('Unsupported OCRA suite data input field: ' . var_export($elem, TRUE));
169
+				throw new Exception('Unsupported OCRA suite data input field: '.var_export($elem, TRUE));
170 170
 			}
171 171
 		}
172 172
 
173 173
 		if (!$this->Q) {
174
-			throw new Exception('OCRA suite data input question not defined: ' . var_export($s[2], TRUE));
174
+			throw new Exception('OCRA suite data input question not defined: '.var_export($s[2], TRUE));
175 175
 		}
176 176
 	}
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$bytes = self::generateRandomBytes($q_length);
183 183
 
184
-		switch($q_type) {
184
+		switch ($q_type) {
185 185
 			case 'A':
186 186
 				$challenge = base64_encode($bytes);
187 187
 				$tr = implode("", unpack('H*', $bytes));
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 				$challenge = implode("", unpack('N*', $bytes));
195 195
 				break;
196 196
 			default:
197
-				throw new Exception('Unsupported OCRASuite challenge type: ' . var_export($q_type, TRUE));
197
+				throw new Exception('Unsupported OCRASuite challenge type: '.var_export($q_type, TRUE));
198 198
 				break;
199 199
 		}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 	public function generateSessionInformation() {
208 208
 		if (!$this->S) {
209
-			throw new Exception('Session information not defined in OCRASuite: ' . var_export($this->OCRASuite, TRUE));
209
+			throw new Exception('Session information not defined in OCRASuite: '.var_export($this->OCRASuite, TRUE));
210 210
 		}
211 211
 
212 212
 		$s_length = $this->SLength;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 		/* Use mt_rand to generate $length random bytes. */
230 230
 		$data = '';
231
-		for($i = 0; $i < $length; $i++) {
231
+		for ($i = 0; $i < $length; $i++) {
232 232
 			$data .= chr(mt_rand(0, 255));
233 233
 		}
234 234
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			return openssl_random_pseudo_bytes($length);
247 247
 		}
248 248
 
249
-		if($fp === NULL) {
249
+		if ($fp === NULL) {
250 250
 			if (@file_exists('/dev/urandom')) {
251 251
 				$fp = @fopen('/dev/urandom', 'rb');
252 252
 			} else {
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 			}
255 255
 		}
256 256
 
257
-		if($fp !== FALSE) {
257
+		if ($fp !== FALSE) {
258 258
 			/* Read random bytes from /dev/urandom. */
259 259
 			$data = fread($fp, $length);
260
-			if($data === FALSE) {
260
+			if ($data === FALSE) {
261 261
 				throw new Exception('Error reading random data.');
262 262
 			}
263
-			if(strlen($data) != $length) {
263
+			if (strlen($data) != $length) {
264 264
 				if ($fallback) {
265 265
 					$data = self::generateRandomBytesMTrand($length);
266 266
 				} else {
267
-					throw new Exception('Did not get requested number of bytes from random source. Requested (' . $length . ') got (' . strlen($data) . ')');
267
+					throw new Exception('Did not get requested number of bytes from random source. Requested ('.$length.') got ('.strlen($data).')');
268 268
 				}
269 269
 			}
270 270
 		} else {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			$result &= ($s1[$i] == $s2[$i]);
291 291
 		}
292 292
 
293
-		return (boolean)$result;
293
+		return (boolean) $result;
294 294
 	}
295 295
 
296 296
 }
Please login to merge, or discard this patch.
library/tiqr/OATH/OCRATest.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once(realpath(dirname(__FILE__) . '/OCRA.php'));
3
+require_once(realpath(dirname(__FILE__).'/OCRA.php'));
4 4
 
5 5
 class OATH_OCRATest extends PHPUnit_Framework_TestCase {
6 6
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 				'ocrasuite' => 'OCRA-1:HOTP-SHA1-6:QN08',
40 40
 				'key' => $key20,
41 41
 				'vectors' => array(
42
-					array('params' => array( 'Q' => '00000000' ), 'result' => '237653' ),
43
-					array('params' => array( 'Q' => '11111111' ), 'result' => '243178' ),
44
-					array('params' => array( 'Q' => '22222222' ), 'result' => '653583' ),
45
-					array('params' => array( 'Q' => '33333333' ), 'result' => '740991' ),
46
-					array('params' => array( 'Q' => '44444444' ), 'result' => '608993' ),
47
-					array('params' => array( 'Q' => '55555555' ), 'result' => '388898' ),
48
-					array('params' => array( 'Q' => '66666666' ), 'result' => '816933' ),
49
-					array('params' => array( 'Q' => '77777777' ), 'result' => '224598' ),
50
-					array('params' => array( 'Q' => '88888888' ), 'result' => '750600' ),
51
-					array('params' => array( 'Q' => '99999999' ), 'result' => '294470' ),
42
+					array('params' => array('Q' => '00000000'), 'result' => '237653'),
43
+					array('params' => array('Q' => '11111111'), 'result' => '243178'),
44
+					array('params' => array('Q' => '22222222'), 'result' => '653583'),
45
+					array('params' => array('Q' => '33333333'), 'result' => '740991'),
46
+					array('params' => array('Q' => '44444444'), 'result' => '608993'),
47
+					array('params' => array('Q' => '55555555'), 'result' => '388898'),
48
+					array('params' => array('Q' => '66666666'), 'result' => '816933'),
49
+					array('params' => array('Q' => '77777777'), 'result' => '224598'),
50
+					array('params' => array('Q' => '88888888'), 'result' => '750600'),
51
+					array('params' => array('Q' => '99999999'), 'result' => '294470'),
52 52
 				)
53 53
 			),
54 54
 			array(
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 				'key' => $key32,
57 57
 				'pin_sha1' => $pin_sha1,
58 58
 				'vectors' => array(
59
-					array('params' => array( 'C' => 0, 'Q' => '12345678' ), 'result' => '65347737' ),
60
-					array('params' => array( 'C' => 1, 'Q' => '12345678' ), 'result' => '86775851' ),
61
-					array('params' => array( 'C' => 2, 'Q' => '12345678' ), 'result' => '78192410' ),
62
-					array('params' => array( 'C' => 3, 'Q' => '12345678' ), 'result' => '71565254' ),
63
-					array('params' => array( 'C' => 4, 'Q' => '12345678' ), 'result' => '10104329' ),
64
-					array('params' => array( 'C' => 5, 'Q' => '12345678' ), 'result' => '65983500' ),
65
-					array('params' => array( 'C' => 6, 'Q' => '12345678' ), 'result' => '70069104' ),
66
-					array('params' => array( 'C' => 7, 'Q' => '12345678' ), 'result' => '91771096' ),
67
-					array('params' => array( 'C' => 8, 'Q' => '12345678' ), 'result' => '75011558' ),
68
-					array('params' => array( 'C' => 9, 'Q' => '12345678' ), 'result' => '08522129' ),
59
+					array('params' => array('C' => 0, 'Q' => '12345678'), 'result' => '65347737'),
60
+					array('params' => array('C' => 1, 'Q' => '12345678'), 'result' => '86775851'),
61
+					array('params' => array('C' => 2, 'Q' => '12345678'), 'result' => '78192410'),
62
+					array('params' => array('C' => 3, 'Q' => '12345678'), 'result' => '71565254'),
63
+					array('params' => array('C' => 4, 'Q' => '12345678'), 'result' => '10104329'),
64
+					array('params' => array('C' => 5, 'Q' => '12345678'), 'result' => '65983500'),
65
+					array('params' => array('C' => 6, 'Q' => '12345678'), 'result' => '70069104'),
66
+					array('params' => array('C' => 7, 'Q' => '12345678'), 'result' => '91771096'),
67
+					array('params' => array('C' => 8, 'Q' => '12345678'), 'result' => '75011558'),
68
+					array('params' => array('C' => 9, 'Q' => '12345678'), 'result' => '08522129'),
69 69
 				)
70 70
 			),
71 71
 			array(
@@ -73,47 +73,47 @@  discard block
 block discarded – undo
73 73
 				'key' => $key32,
74 74
 				'pin_sha1' => $pin_sha1,
75 75
 				'vectors' => array(
76
-					array('params' => array( 'Q' => '00000000' ), 'result' => '83238735' ),
77
-					array('params' => array( 'Q' => '11111111' ), 'result' => '01501458' ),
78
-					array('params' => array( 'Q' => '22222222' ), 'result' => '17957585' ),
79
-					array('params' => array( 'Q' => '33333333' ), 'result' => '86776967' ),
80
-					array('params' => array( 'Q' => '44444444' ), 'result' => '86807031' ),
76
+					array('params' => array('Q' => '00000000'), 'result' => '83238735'),
77
+					array('params' => array('Q' => '11111111'), 'result' => '01501458'),
78
+					array('params' => array('Q' => '22222222'), 'result' => '17957585'),
79
+					array('params' => array('Q' => '33333333'), 'result' => '86776967'),
80
+					array('params' => array('Q' => '44444444'), 'result' => '86807031'),
81 81
 				)
82 82
 			),
83 83
 			array(
84 84
 				'ocrasuite' => 'OCRA-1:HOTP-SHA512-8:C-QN08',
85 85
 				'key' => $key64,
86 86
 				'vectors' => array(
87
-					array('params' => array( 'C' => '00000', 'Q' => '00000000' ), 'result' => '07016083' ),
88
-					array('params' => array( 'C' => '00001', 'Q' => '11111111' ), 'result' => '63947962' ),
89
-					array('params' => array( 'C' => '00002', 'Q' => '22222222' ), 'result' => '70123924' ),
90
-					array('params' => array( 'C' => '00003', 'Q' => '33333333' ), 'result' => '25341727' ),
91
-					array('params' => array( 'C' => '00004', 'Q' => '44444444' ), 'result' => '33203315' ),
92
-					array('params' => array( 'C' => '00005', 'Q' => '55555555' ), 'result' => '34205738' ),
93
-					array('params' => array( 'C' => '00006', 'Q' => '66666666' ), 'result' => '44343969' ),
94
-					array('params' => array( 'C' => '00007', 'Q' => '77777777' ), 'result' => '51946085' ),
95
-					array('params' => array( 'C' => '00008', 'Q' => '88888888' ), 'result' => '20403879' ),
96
-					array('params' => array( 'C' => '00009', 'Q' => '99999999' ), 'result' => '31409299' ),
87
+					array('params' => array('C' => '00000', 'Q' => '00000000'), 'result' => '07016083'),
88
+					array('params' => array('C' => '00001', 'Q' => '11111111'), 'result' => '63947962'),
89
+					array('params' => array('C' => '00002', 'Q' => '22222222'), 'result' => '70123924'),
90
+					array('params' => array('C' => '00003', 'Q' => '33333333'), 'result' => '25341727'),
91
+					array('params' => array('C' => '00004', 'Q' => '44444444'), 'result' => '33203315'),
92
+					array('params' => array('C' => '00005', 'Q' => '55555555'), 'result' => '34205738'),
93
+					array('params' => array('C' => '00006', 'Q' => '66666666'), 'result' => '44343969'),
94
+					array('params' => array('C' => '00007', 'Q' => '77777777'), 'result' => '51946085'),
95
+					array('params' => array('C' => '00008', 'Q' => '88888888'), 'result' => '20403879'),
96
+					array('params' => array('C' => '00009', 'Q' => '99999999'), 'result' => '31409299'),
97 97
 				)
98 98
 			),
99 99
 			array(
100 100
 				'ocrasuite' => 'OCRA-1:HOTP-SHA512-8:QN08-T1M',
101 101
 				'key' => $key64,
102 102
 				'vectors' => array(
103
-					array('params' => array( 'Q' => '00000000', 'T' => intval('132d0b6', 16) ), 'result' => '95209754' ),
104
-					array('params' => array( 'Q' => '11111111', 'T' => intval('132d0b6', 16) ), 'result' => '55907591' ),
105
-					array('params' => array( 'Q' => '22222222', 'T' => intval('132d0b6', 16) ), 'result' => '22048402' ),
106
-					array('params' => array( 'Q' => '33333333', 'T' => intval('132d0b6', 16) ), 'result' => '24218844' ),
107
-					array('params' => array( 'Q' => '44444444', 'T' => intval('132d0b6', 16) ), 'result' => '36209546' ),
103
+					array('params' => array('Q' => '00000000', 'T' => intval('132d0b6', 16)), 'result' => '95209754'),
104
+					array('params' => array('Q' => '11111111', 'T' => intval('132d0b6', 16)), 'result' => '55907591'),
105
+					array('params' => array('Q' => '22222222', 'T' => intval('132d0b6', 16)), 'result' => '22048402'),
106
+					array('params' => array('Q' => '33333333', 'T' => intval('132d0b6', 16)), 'result' => '24218844'),
107
+					array('params' => array('Q' => '44444444', 'T' => intval('132d0b6', 16)), 'result' => '36209546'),
108 108
 				)
109 109
 			),
110 110
 		);
111 111
 
112 112
 		$data = array();
113 113
 
114
-		foreach($tests as $test) {
114
+		foreach ($tests as $test) {
115 115
 			$ocrasuite = $test['ocrasuite'];
116
-			foreach($test['vectors'] as $vector) {
116
+			foreach ($test['vectors'] as $vector) {
117 117
 				$datainput = $vector['params'];
118 118
 				if (isset($test['pin'])) {
119 119
 					$datainput['P'] = $test['pin'];
Please login to merge, or discard this patch.