diff --git a/include/fc/crypto/elliptic.hpp b/include/fc/crypto/elliptic.hpp index b747ac9..31e50a0 100644 --- a/include/fc/crypto/elliptic.hpp +++ b/include/fc/crypto/elliptic.hpp @@ -23,6 +23,7 @@ namespace fc { typedef fc::array public_key_point_data; ///< the full non-compressed version of the ECC point typedef fc::array signature; typedef fc::array compact_signature; + typedef std::vector range_proof_type; /** * @class public_key @@ -151,9 +152,9 @@ namespace fc { blind_factor_type blind_sum( const std::vector& blinds, uint32_t non_neg ); /** verifies taht commnits + neg_commits + excess == 0 */ bool verify_sum( const std::vector& commits, const std::vector& neg_commits, int64_t excess ); - bool verify_range( uint64_t& min_val, uint64_t& max_val, const commitment_type& commit, const std::vector& proof ); + bool verify_range( uint64_t& min_val, uint64_t& max_val, const commitment_type& commit, const range_proof_type& proof ); - std::vector range_proof_sign( uint64_t min_value, + range_proof_type range_proof_sign( uint64_t min_value, const commitment_type& commit, const blind_factor_type& commit_blind, const blind_factor_type& nonce, @@ -169,8 +170,8 @@ namespace fc { uint64_t& min_val, uint64_t& max_val, commitment_type commit, - const std::vector& proof ); - range_proof_info range_get_info( const std::vector& proof ); + const range_proof_type& proof ); + range_proof_info range_get_info( const range_proof_type& proof ); diff --git a/tests/blind.cpp b/tests/blind.cpp index 91be6a5..bd74519 100644 --- a/tests/blind.cpp +++ b/tests/blind.cpp @@ -43,9 +43,11 @@ int main( int argc, char** argv ) auto B1 = fc::sha256::hash("B1"); auto B2 = fc::sha256::hash("B2"); auto b3 = fc::sha256::hash("b3"); - auto C1 = fc::ecc::blind( B1, 1 ); - auto C2 = fc::ecc::blind( B2, 2 ); - auto c3 = fc::ecc::blind( b3, 3 ); + auto B4 = fc::sha256::hash("B4"); + auto C1 = fc::ecc::blind( B1, 1 ); + auto C2 = fc::ecc::blind( B2, 2 ); + auto c3 = fc::ecc::blind( b3, 3 ); + auto C4 = fc::ecc::blind( B4, -1 ); auto B3 = fc::ecc::blind_sum( {B1,B2}, 2 ); auto C3 = fc::ecc::blind( B3, 3 ); @@ -56,6 +58,7 @@ int main( int argc, char** argv ) FC_ASSERT( fc::ecc::verify_sum( {C1,C2}, {C3}, 0 ) ); FC_ASSERT( fc::ecc::verify_sum( {C3}, {C1,C2}, 0 ) ); + FC_ASSERT( fc::ecc::verify_sum( {C3}, {C1,C2}, 0 ) ); {