crypto/client/schnorr/ringsign/signature.go
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package ringsign
import (
"crypto/ecdsa"
"crypto/elliptic"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"log"
"math/big"
mathRand "math/rand"
schnorr_sign "github.com/xuperchain/xuperunion/crypto/client/schnorr/sign"
"github.com/xuperchain/xuperunion/crypto/common"
"github.com/xuperchain/xuperunion/crypto/hash"
"github.com/xuperchain/xuperunion/hdwallet/rand"
)
// define errors
var (
ErrGenerateRingSignature = errors.New("failed to generate ring signature")
ErrTooSmallNumOfkeys = errors.New("The total num of keys should be greater than one")
ErrCurveParamNil = errors.New("curve input param is nil")
ErrNotExactTheSameCurveInput = errors.New("the curve is not same as curve of members")
ErrInvalidInputParams = errors.New("invalid input")
ErrKeyParamNotMatch = errors.New("key param not match")
)
// ring sign consts
const (
MinimumParticipant = 2
)
//type RingSignature struct {
// members []*ecdsa.PublicKey
// e []byte
// s [][]byte
//}
//type PublicKeyFactor struct {
// X, Y *big.Int
//}
//
//type RingSignature struct {
// elliptic.Curve
// Members []*PublicKeyFactor
// E *big.Int
// S []*big.Int
//}
// Sign : Schnorr Ring Signature use a particular function, the same as Schnorr signatures, defined as:
// H'(m, s(i), e(i)) = H(m || s(i)*G + e(i)*P(i))
//
// To verify the ring signature, check that the result of H'(m, s(i), e(i)) is equal to e((i+1) % R).
// Which means that: H(m || s(i)*G + e(i)*P(i)) = e((i+1) % R)
//
// P is the public key. P(i) = x(i)*G ---- x is the scalar factor of the private key
// R is the total number of P(0), P(1), ..., P(R-1) which are all the public keys participate in generating the ring signature.
后面还有 288 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
