@@ -45,25 +45,25 @@ discard block |
||
45 | 45 | $this->pemInitialDataCheck($keypair); |
46 | 46 | |
47 | 47 | $ecpemstruct = array( |
48 | - 'sequence_beg' => '30', |
|
49 | - 'total_len' => '74', |
|
50 | - 'int_sec_beg' => '02', |
|
51 | - 'int_sec_len' => '01', |
|
52 | - 'int_sec_val' => '01', |
|
53 | - 'oct_sec_beg' => '04', |
|
54 | - 'oct_sec_len' => '20', |
|
55 | - 'oct_sec_val' => $keypair[0], |
|
56 | - 'a0_ele_beg' => 'a0', |
|
57 | - 'a0_ele_len' => '07', |
|
58 | - 'obj_id_beg' => '06', |
|
59 | - 'obj_id_len' => '05', |
|
60 | - 'obj_id_val' => '2b8104000a', |
|
61 | - 'a1_ele_beg' => 'a1', |
|
62 | - 'a1_ele_len' => '44', |
|
63 | - 'bit_str_beg' => '03', |
|
64 | - 'bit_str_len' => '42', |
|
65 | - 'bit_str_val' => '00' . $keypair[1], |
|
66 | - ); |
|
48 | + 'sequence_beg' => '30', |
|
49 | + 'total_len' => '74', |
|
50 | + 'int_sec_beg' => '02', |
|
51 | + 'int_sec_len' => '01', |
|
52 | + 'int_sec_val' => '01', |
|
53 | + 'oct_sec_beg' => '04', |
|
54 | + 'oct_sec_len' => '20', |
|
55 | + 'oct_sec_val' => $keypair[0], |
|
56 | + 'a0_ele_beg' => 'a0', |
|
57 | + 'a0_ele_len' => '07', |
|
58 | + 'obj_id_beg' => '06', |
|
59 | + 'obj_id_len' => '05', |
|
60 | + 'obj_id_val' => '2b8104000a', |
|
61 | + 'a1_ele_beg' => 'a1', |
|
62 | + 'a1_ele_len' => '44', |
|
63 | + 'bit_str_beg' => '03', |
|
64 | + 'bit_str_len' => '42', |
|
65 | + 'bit_str_val' => '00' . $keypair[1], |
|
66 | + ); |
|
67 | 67 | |
68 | 68 | $dec = trim(implode($ecpemstruct)); |
69 | 69 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $this->pemDataLenCheck($decoded); |
87 | 87 | |
88 | 88 | $ecpemstruct = array( |
89 | - 'oct_sec_val' => substr($decoded, 14, 64), |
|
90 | - 'obj_id_val' => substr($decoded, 86, 10), |
|
91 | - 'bit_str_val' => substr($decoded, 106), |
|
89 | + 'oct_sec_val' => substr($decoded, 14, 64), |
|
90 | + 'obj_id_val' => substr($decoded, 86, 10), |
|
91 | + 'bit_str_val' => substr($decoded, 106), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | $this->pemOidCheck($ecpemstruct['obj_id_val']); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | $this->pemKeyLenCheck(array($private_key, $public_key)); |
100 | 100 | |
101 | 101 | return array( |
102 | - 'private_key' => $private_key, |
|
103 | - 'public_key' => $public_key |
|
102 | + 'private_key' => $private_key, |
|
103 | + 'public_key' => $public_key |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $this->raw_signature = ''; |
82 | 82 | |
83 | 83 | $this->P = array( |
84 | - 'x' => $this->Gx, |
|
85 | - 'y' => $this->Gy |
|
84 | + 'x' => $this->Gx, |
|
85 | + 'y' => $this->Gy |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | $this->keyUtil = new \Phactor\Key; |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $signature = array( |
152 | - 'r' => $this->addHexPrefix(str_pad($this->encodeHex($r, false), 64, "0", STR_PAD_LEFT)), |
|
153 | - 's' => $this->addHexPrefix(str_pad($this->encodeHex($s, false), 64, "0", STR_PAD_LEFT)) |
|
154 | - ); |
|
152 | + 'r' => $this->addHexPrefix(str_pad($this->encodeHex($r, false), 64, "0", STR_PAD_LEFT)), |
|
153 | + 's' => $this->addHexPrefix(str_pad($this->encodeHex($s, false), 64, "0", STR_PAD_LEFT)) |
|
154 | + ); |
|
155 | 155 | |
156 | 156 | $this->r_coordinate = $signature['r']; |
157 | 157 | $this->s_coordinate = $signature['s']; |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | $retval = array( |
249 | 249 | 'bin_r' => $this->msbCheck($r[0]) . $r, |
250 | 250 | 'bin_s' => $this->msbCheck($s[0]) . $s |
251 | - ); |
|
251 | + ); |
|
252 | 252 | |
253 | 253 | $seq = chr(0x02) . chr(strlen($retval['bin_r'])) . $retval['bin_r'] . |
254 | - chr(0x02) . chr(strlen($retval['bin_s'])) . $retval['bin_s']; |
|
254 | + chr(0x02) . chr(strlen($retval['bin_s'])) . $retval['bin_s']; |
|
255 | 255 | |
256 | 256 | return bin2hex(chr(0x30) . chr(strlen($seq)) . $seq); |
257 | 257 | } |
@@ -270,19 +270,19 @@ discard block |
||
270 | 270 | |
271 | 271 | /* This is the main structure we'll use for storing our parsed signature. */ |
272 | 272 | $ecdsa_struct = array( |
273 | - 'sigstart' => '', |
|
274 | - 'siglen' => '', |
|
275 | - 'rtype' => '', |
|
276 | - 'rlen' => '', |
|
277 | - 'roffset' => 0, |
|
278 | - 'r' => '', |
|
279 | - 'stype' => '', |
|
280 | - 'slen' => '', |
|
281 | - 'soffset' => 0, |
|
282 | - 's' => '', |
|
283 | - 'original' => '', |
|
284 | - 'totallen' => 0 |
|
285 | - ); |
|
273 | + 'sigstart' => '', |
|
274 | + 'siglen' => '', |
|
275 | + 'rtype' => '', |
|
276 | + 'rlen' => '', |
|
277 | + 'roffset' => 0, |
|
278 | + 'r' => '', |
|
279 | + 'stype' => '', |
|
280 | + 'slen' => '', |
|
281 | + 'soffset' => 0, |
|
282 | + 's' => '', |
|
283 | + 'original' => '', |
|
284 | + 'totallen' => 0 |
|
285 | + ); |
|
286 | 286 | |
287 | 287 | $ecdsa_struct['original'] = $signature; |
288 | 288 | $ecdsa_struct['totallen'] = strlen($signature); |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | $this->RangeCheck($ecdsa_struct['r']); |
334 | 334 | |
335 | 335 | return array( |
336 | - 'r' => $ecdsa_struct['r'], |
|
337 | - 's' => $ecdsa_struct['s'] |
|
336 | + 'r' => $ecdsa_struct['r'], |
|
337 | + 's' => $ecdsa_struct['s'] |
|
338 | 338 | ); |
339 | 339 | } |
340 | 340 |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | public function GenerateNewPoint($ladder = true) |
268 | 268 | { |
269 | 269 | $P = array( |
270 | - 'x' => $this->Gx, |
|
271 | - 'y' => $this->Gy |
|
272 | - ); |
|
270 | + 'x' => $this->Gx, |
|
271 | + 'y' => $this->Gy |
|
272 | + ); |
|
273 | 273 | |
274 | 274 | do { |
275 | 275 | $random_number = $this->SecureRandomNumber(); |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | return array( |
288 | - 'random_number' => $random_number, |
|
289 | - 'R' => $R, |
|
290 | - 'Rx_hex' => $Rx_hex, |
|
291 | - 'Ry_hex' => $Ry_hex |
|
288 | + 'random_number' => $random_number, |
|
289 | + 'R' => $R, |
|
290 | + 'Rx_hex' => $Rx_hex, |
|
291 | + 'Ry_hex' => $Ry_hex |
|
292 | 292 | ); |
293 | 293 | } |
294 | 294 |
@@ -240,7 +240,7 @@ |
||
240 | 240 | case 'unk': |
241 | 241 | throw new \Exception('Unknown number type in BC::bcNormalize(). Cannot process!'); |
242 | 242 | } |
243 | - **/ |
|
243 | + **/ |
|
244 | 244 | |
245 | 245 | return $a; |
246 | 246 | } |
@@ -65,12 +65,12 @@ |
||
65 | 65 | public function __construct($pubkey = '', $type = '02', $version = '0F') |
66 | 66 | { |
67 | 67 | $this->rawHashes = array( |
68 | - 'step1' => null, |
|
69 | - 'step2' => null, |
|
70 | - 'step3' => null, |
|
71 | - 'step4' => null, |
|
72 | - 'step5' => null, |
|
73 | - 'step6' => null, |
|
68 | + 'step1' => null, |
|
69 | + 'step2' => null, |
|
70 | + 'step3' => null, |
|
71 | + 'step4' => null, |
|
72 | + 'step5' => null, |
|
73 | + 'step6' => null, |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $this->encoded = ''; |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | public function __toString() |
82 | 82 | { |
83 | 83 | return json_encode(array( |
84 | - 'WIF_address' => $this->WIF_address, |
|
85 | - 'private_key' => $this->private_key, |
|
86 | - 'network_type' => $this->network_type, |
|
87 | - 'compressed_pubkey' => $this->compressed_pubkey_format, |
|
88 | - 'checksum' => $this->checksum) |
|
89 | - ); |
|
84 | + 'WIF_address' => $this->WIF_address, |
|
85 | + 'private_key' => $this->private_key, |
|
86 | + 'network_type' => $this->network_type, |
|
87 | + 'compressed_pubkey' => $this->compressed_pubkey_format, |
|
88 | + 'checksum' => $this->checksum) |
|
89 | + ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | $decoded_key = $this->stripHexPrefix($this->decodeBase58(trim($WIF_encoded_key))); |
383 | 383 | |
384 | 384 | list($private_key, $checksum_provided) = array( |
385 | - substr($decoded_key, 0, -8), |
|
386 | - substr($decoded_key, strlen($decoded_key) - 8) |
|
387 | - ); |
|
385 | + substr($decoded_key, 0, -8), |
|
386 | + substr($decoded_key, strlen($decoded_key) - 8) |
|
387 | + ); |
|
388 | 388 | |
389 | 389 | $private_key_type = substr($private_key, 0, 2); |
390 | 390 |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | $params = $params ?? []; |
53 | 53 | |
54 | 54 | $this->keyInfo = array( |
55 | - 'private_key_hex' => $this->keyValueCheck($params['private_key_hex'] ?? null), |
|
56 | - 'private_key_dec' => $this->keyValueCheck($params['private_key_dec'] ?? null), |
|
57 | - 'public_key' => $this->keyValueCheck($params['public_key'] ?? null), |
|
58 | - 'public_key_compressed' => $this->keyValueCheck($params['public_key_compressed'] ?? null), |
|
59 | - 'public_key_x' => $this->keyValueCheck($params['public_key_x'] ?? null), |
|
60 | - 'public_key_y' => $this->keyValueCheck($params['public_key_y'] ?? null), |
|
61 | - 'generation_time' => '', |
|
62 | - ); |
|
55 | + 'private_key_hex' => $this->keyValueCheck($params['private_key_hex'] ?? null), |
|
56 | + 'private_key_dec' => $this->keyValueCheck($params['private_key_dec'] ?? null), |
|
57 | + 'public_key' => $this->keyValueCheck($params['public_key'] ?? null), |
|
58 | + 'public_key_compressed' => $this->keyValueCheck($params['public_key_compressed'] ?? null), |
|
59 | + 'public_key_x' => $this->keyValueCheck($params['public_key_x'] ?? null), |
|
60 | + 'public_key_y' => $this->keyValueCheck($params['public_key_y'] ?? null), |
|
61 | + 'generation_time' => '', |
|
62 | + ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $comp_prefix = ($this->Modulo($point['R']['y'], '2') == '1') ? '03' : '02'; |
121 | 121 | |
122 | 122 | $this->keyInfo = array( |
123 | - 'private_key_hex' => $this->encodeHex($point['random_number']), |
|
124 | - 'private_key_dec' => $point['random_number'], |
|
125 | - 'public_key' => '04' . $point['Rx_hex'] . $point['Ry_hex'], |
|
126 | - 'public_key_compressed' => $comp_prefix . $point['Rx_hex'], |
|
127 | - 'public_key_x' => $point['Rx_hex'], |
|
128 | - 'public_key_y' => $point['Ry_hex'], |
|
129 | - ); |
|
123 | + 'private_key_hex' => $this->encodeHex($point['random_number']), |
|
124 | + 'private_key_dec' => $point['random_number'], |
|
125 | + 'public_key' => '04' . $point['Rx_hex'] . $point['Ry_hex'], |
|
126 | + 'public_key_compressed' => $comp_prefix . $point['Rx_hex'], |
|
127 | + 'public_key_x' => $point['Rx_hex'], |
|
128 | + 'public_key_y' => $point['Ry_hex'], |
|
129 | + ); |
|
130 | 130 | |
131 | 131 | return $this->keyInfo; |
132 | 132 | } |