The rapidly increasing expansion of distributed energy resources (DER), such as renewable energy systems and energy storage systems into the electric power system and the integration of advanced information and communication technologies enable DER owners to participate in the electricity market for grid services. For more efficient and reliable power system operation, the concept of peer-to-peer (P2P) energy trading has recently been proposed. The adoption of blockchain technology in P2P energy trading has been considered to be the most promising solution enabling secure smart contracts between prosumers and users. However, privacy concerns arise because the sensitive data and transaction records of the participants, i.e., the prosumers and the distribution system operator (DSO), become available to the blockchain nodes. Many efforts have been made to resolve this issue. A recent breakthrough in a P2P energy trading system on an Ethereum blockchain is that all bid values are encrypted using functional encryption and peer matching for trading is performed securely on these encrypted bids. Their protocol is based on a method that encodes integers to vectors and an algorithm that securely compares the ciphertexts of these vectors. However, the comparison method is not very efficient in terms of the range of possible bid values because the amount of computation grows linearly according to the size of this range. This paper addresses this challenge by proposing a new bid encoding algorithm called dual binary encoding, which dramatically reduces the amount of computation as it is only proportional to the square of the logarithm of the size of the encoding range. Moreover, we propose a practical mechanism for rebidding the remaining amount caused when the amounts from the two matching peers are not equal. Finally, the feasibility of the proposed method is evaluated by using a virtual energy trade testbed and a private Ethereum blockchain platform.