lib/WalletManager.php
/*
     * Create a valid base58 encoded Monero address from public keys
     *
     * @param string Public spend key
     * @param string Public view key
     *
     * @return string Base58 encoded Monero address
     */
Create a valid base58 encoded Monero address from public keys
@param string Public spend key
@param string Public view key

@return string Base58 encoded Monero address
Create a valid base58 encoded Monero address from public keys @param string Public spend key @param string Public view key @return string Base58 encoded Monero address
public function encode_address($pSpendKey, $pViewKey)
    {
        if (strlen($pSpendKey) !== 64) {
            throw new Exception('Error: Incorrect public spend key length');
        }
        if (strlen($pViewKey) !== 64) {
            throw new Exception('Error: Incorrect public view key length');
        }
        $preAddr = $this->wallet_prefix . $pSpendKey . $pViewKey;
        $checksum = $this->keccak_256($preAddr);
        $data = $preAddr . substr($checksum, 0, 8);
        $encoded = $this->base58->encode($data);
        if (strlen($encoded) !== 98) {
            throw new Exception('Error: Incorrect wallet address length');
        }
        return $encoded;
    }
public function encode_address ( $ pSpendKey , $ pViewKey ) { if ( strlen ( $ pSpendKey ) !== 64 ) { throw new Exception ( 'Error: Incorrect public spend key length' ) ; } if ( strlen ( $ pViewKey ) !== 64 ) { throw new Exception ( 'Error: Incorrect public view key length' ) ; } $ preAddr = $ this -> wallet_prefix . $ pSpendKey . $ pViewKey ; $ checksum = $ this -> keccak_256 ( $ preAddr ) ; $ data = $ preAddr . substr ( $ checksum , 0 , 8 ) ; $ encoded = $ this -> base58 -> encode ( $ data ) ; if ( strlen ( $ encoded ) !== 98 ) { throw new Exception ( 'Error: Incorrect wallet address length' ) ; } return $ encoded ; }
Create a valid base58 encoded Monero address from public keys
 @param string Public spend key
 @param string Public view key
Create a valid base58 encoded Monero address from public keys @param string Public spend key @param string Public view key
// Validate the spend key length. // Validate the view key length. // Validate the address length.