Passed
Push — develop ( 6fb9ed...4c8ea7 )
by Pieter van der
01:18 queued 14s
created
library/tiqr/Tiqr/OATH/OCRA.php 1 patch
Braces   +42 added lines, -28 removed lines patch added patch discarded remove patch
@@ -122,12 +122,15 @@  discard block
 block discarded – undo
122 122
         $cryptoFunction = $components[1];
123 123
         $dataInput = strtolower($components[2]); // lower here so we can do case insensitive comparisons
124 124
         
125
-        if(stripos($cryptoFunction, "sha1")!==false)
126
-            $crypto = "sha1";
127
-        if(stripos($cryptoFunction, "sha256")!==false)
128
-            $crypto = "sha256";
129
-        if(stripos($cryptoFunction, "sha512")!==false)
130
-            $crypto = "sha512";
125
+        if(stripos($cryptoFunction, "sha1")!==false) {
126
+                    $crypto = "sha1";
127
+        }
128
+        if(stripos($cryptoFunction, "sha256")!==false) {
129
+                    $crypto = "sha256";
130
+        }
131
+        if(stripos($cryptoFunction, "sha512")!==false) {
132
+                    $crypto = "sha512";
133
+        }
131 134
         
132 135
         $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-")+1);
133 136
                 
@@ -135,56 +138,65 @@  discard block
 block discarded – undo
135 138
         // Counter
136 139
         if($dataInput[0] == "c" ) {
137 140
             // Fix the length of the HEX string
138
-            while(strlen($counter) < 16)
139
-                $counter = "0" . $counter;
141
+            while(strlen($counter) < 16) {
142
+                            $counter = "0" . $counter;
143
+            }
140 144
             $counterLength=8;
141 145
         }
142 146
         // Question
143 147
         if($dataInput[0] == "q" ||
144 148
                 stripos($dataInput, "-q")!==false) {
145
-            while(strlen($question) < 256)
146
-                $question = $question . "0";
149
+            while(strlen($question) < 256) {
150
+                            $question = $question . "0";
151
+            }
147 152
             $questionLength=128;
148 153
         }
149 154
 
150 155
         // Password
151 156
         if(stripos($dataInput, "psha1")!==false) {
152
-            while(strlen($password) < 40)
153
-                $password = "0" . $password;
157
+            while(strlen($password) < 40) {
158
+                            $password = "0" . $password;
159
+            }
154 160
             $passwordLength=20;
155 161
         }
156 162
     
157 163
         if(stripos($dataInput, "psha256")!==false) {
158
-            while(strlen($password) < 64)
159
-                $password = "0" . $password;
164
+            while(strlen($password) < 64) {
165
+                            $password = "0" . $password;
166
+            }
160 167
             $passwordLength=32;
161 168
         }
162 169
         
163 170
         if(stripos($dataInput, "psha512")!==false) {
164
-            while(strlen($password) < 128)
165
-                $password = "0" . $password;
171
+            while(strlen($password) < 128) {
172
+                            $password = "0" . $password;
173
+            }
166 174
             $passwordLength=64;
167 175
         }
168 176
         
169 177
         // sessionInformation
170 178
         if(stripos($dataInput, "s064") !==false) {
171
-            while(strlen($sessionInformation) < 128)
172
-                $sessionInformation = "0" . $sessionInformation;
179
+            while(strlen($sessionInformation) < 128) {
180
+                            $sessionInformation = "0" . $sessionInformation;
181
+            }
173 182
 
174 183
             $sessionInformationLength=64;
175 184
         } else if(stripos($dataInput, "s128") !==false) {
176
-            while(strlen($sessionInformation) < 256)
177
-                $sessionInformation = "0" . $sessionInformation;
185
+            while(strlen($sessionInformation) < 256) {
186
+                            $sessionInformation = "0" . $sessionInformation;
187
+            }
178 188
         
179 189
             $sessionInformationLength=128;
180 190
         } else if(stripos($dataInput, "s256") !==false) {
181
-            while(strlen($sessionInformation) < 512)
182
-                $sessionInformation = "0" . $sessionInformation;
191
+            while(strlen($sessionInformation) < 512) {
192
+                            $sessionInformation = "0" . $sessionInformation;
193
+            }
183 194
         
184 195
             $sessionInformationLength=256;
185 196
         } else if(stripos($dataInput, "s512") !==false) {
186
-            while(strlen($sessionInformation) < 128)
187
-                $sessionInformation = "0" . $sessionInformation;
197
+            while(strlen($sessionInformation) < 128) {
198
+                            $sessionInformation = "0" . $sessionInformation;
199
+            }
188 200
         
189 201
             $sessionInformationLength=64;
190 202
         } else if (stripos($dataInput, "-s") !== false ) {
@@ -196,8 +208,9 @@  discard block
 block discarded – undo
196 208
             // to prevent matching the "s" in the password input e.g. "psha1".
197 209
             // [C] | QFxx | [PH | Snnn | TG] : Challenge-Response computation
198 210
             // [C] | QFxx | [PH | TG] : Plain Signature computation
199
-            while(strlen($sessionInformation) < 128)
200
-                $sessionInformation = "0" . $sessionInformation;
211
+            while(strlen($sessionInformation) < 128) {
212
+                            $sessionInformation = "0" . $sessionInformation;
213
+            }
201 214
             
202 215
             $sessionInformationLength=64;
203 216
         }
@@ -207,8 +220,9 @@  discard block
 block discarded – undo
207 220
         // TimeStamp
208 221
         if($dataInput[0] == "t" ||
209 222
                 stripos($dataInput, "-t") !== false) {
210
-            while(strlen($timeStamp) < 16)
211
-                $timeStamp = "0" . $timeStamp;
223
+            while(strlen($timeStamp) < 16) {
224
+                            $timeStamp = "0" . $timeStamp;
225
+            }
212 226
             $timeStampLength=8;
213 227
         }
214 228
 
Please login to merge, or discard this patch.