LCOV - code coverage report
Current view: top level - src/libzerocoin - CoinRandomnessSchnorrSignature.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 0 3 0.0 %
Date: 2025-04-02 01:23:23 Functions: 0 1 0.0 %

          Line data    Source code
       1             : // Copyright (c) 2019-2021 The PIVX Core developers
       2             : // Distributed under the MIT/X11 software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #ifndef PIVX_LIBZEROCOIN_COINRANDOMNESSSCHNORRSIGNATURE_H
       6             : #define PIVX_LIBZEROCOIN_COINRANDOMNESSSCHNORRSIGNATURE_H
       7             : 
       8             : #include "Params.h"
       9             : #include "Coin.h"
      10             : #include "serialize.h"
      11             : #include "hash.h"
      12             : 
      13             : namespace libzerocoin {
      14             : 
      15             : /**A Schnorr Signature on the hash of metadata attesting that the signer knows the randomness v
      16             :  *  necessary to open a public coin C (which is a pedersen commitment g^S h^v mod p) with
      17             :  * given serial number S.
      18             :  */
      19           0 : class CoinRandomnessSchnorrSignature {
      20             : public:
      21           0 :     CoinRandomnessSchnorrSignature() {};
      22             :     template <typename Stream> explicit CoinRandomnessSchnorrSignature(Stream& strm) {strm >> *this;}
      23             : 
      24             :     /** Creates a Schnorr signature object using the randomness of a public coin as private key sk.
      25             :      *
      26             :      * @param zcparams zerocoin params (group modulus, order and generators)
      27             :      * @param randomness the coin we are going to use for the signature (sk := randomness, pk := h^sk mod p).
      28             :      * @param msghash hash of meta data to create a signature on.
      29             :      */
      30             :     CoinRandomnessSchnorrSignature(const ZerocoinParams* zcparams, const CBigNum randomness, const uint256 msghash);
      31             : 
      32             :     /** Verifies the Schnorr signature on message msghash with public key pk = Cg^-S mod p
      33             :      *
      34             :      * @param zcparams zerocoin params (group modulus, order and generators)
      35             :      * @param S serial number of the coin used for the signature
      36             :      * @param C value of the public coin (commitment to serial S and randomness v) used for the signature.
      37             :      * @param msghash hash of meta data to verify the signature on.
      38             :      * @return
      39             :      */
      40             :     bool Verify(const ZerocoinParams* zcparams, const CBigNum& S, const CBigNum& C, const uint256 msghash) const;
      41             : 
      42           0 :     SERIALIZE_METHODS(CoinRandomnessSchnorrSignature, obj) { READWRITE(obj.alpha, obj.beta); }
      43             : 
      44             : private:
      45             :     // signature components
      46             :     CBigNum alpha, beta;
      47             : };
      48             : 
      49             : } /* namespace libzerocoin */
      50             : #endif // PIVX_LIBZEROCOIN_COINRANDOMNESSSCHNORRSIGNATURE_H

Generated by: LCOV version 1.14