|
@@ -330,13 +330,13 @@ discard block |
|
|
block discarded – undo |
|
330
|
330
|
/* |
|
331
|
331
|
* 2. Add a 0x80 byte in front of it for mainnet addresses or 0xef for testnet addresses. |
|
332
|
332
|
*/ |
|
333
|
|
- $step2 = ($network == 'main') ? '80' . $step1 : 'ef' . $step1; |
|
|
333
|
+ $step2 = ($network == 'main') ? '80'.$step1 : 'ef'.$step1; |
|
334
|
334
|
|
|
335
|
335
|
/* |
|
336
|
336
|
* 3. Append a 0x01 byte after it if it should be used with compressed public keys. Nothing is appended |
|
337
|
337
|
* if it is used with uncompressed public keys. |
|
338
|
338
|
*/ |
|
339
|
|
- $step3 = ($public_key_format == 'compressed') ? $step2 . '01' : $step2; |
|
|
339
|
+ $step3 = ($public_key_format == 'compressed') ? $step2.'01' : $step2; |
|
340
|
340
|
|
|
341
|
341
|
/* |
|
342
|
342
|
* 4. Perform a SHA-256 hash on the extended key. |
|
@@ -356,7 +356,7 @@ discard block |
|
|
block discarded – undo |
|
356
|
356
|
/* |
|
357
|
357
|
* 7. Add the four checksum bytes from step 6 at the end of the extended key from step 3. |
|
358
|
358
|
*/ |
|
359
|
|
- $step7 = $step3 . $this->checksum; |
|
|
359
|
+ $step7 = $step3.$this->checksum; |
|
360
|
360
|
|
|
361
|
361
|
/* |
|
362
|
362
|
* 8. Convert the result from a byte string into a Base58 string using Base58Check encoding. |
|
@@ -397,7 +397,7 @@ discard block |
|
|
block discarded – undo |
|
397
|
397
|
$private_key = ($compressed_public_key == '01') ? substr($private_key, 0, -2) : $private_key; |
|
398
|
398
|
|
|
399
|
399
|
/* Now let's check our private key against the checksum provided. */ |
|
400
|
|
- $new_checksum = substr(hash('sha256', hash('sha256', $this->binConv($private_key_type . $private_key . $compressed_public_key), true)), 0, 8); |
|
|
400
|
+ $new_checksum = substr(hash('sha256', hash('sha256', $this->binConv($private_key_type.$private_key.$compressed_public_key), true)), 0, 8); |
|
401
|
401
|
|
|
402
|
402
|
if ($new_checksum != $checksum_provided) { |
|
403
|
403
|
throw new \Exception('Invalid WIF encoded private key! Checksum is incorrect!'); |