func calculateParams(N *big.Int, aux string, securityLevel uint32, params *Params) error {
	params.Initialized = false
	params.AccumulatorParams.Initialized = false

	l := N.BitLen()
	if l < 1023 {
		return errors.New("Modulus must be at least 1023 bits")
	}

	if securityLevel < 80 {
		return errors.New("Security level must be at least 80 bits")
	}

	params.AccumulatorParams.AccumulatorModulus = N

	pLen, qLen, err := calculateGroupParamLengths(uint32(l-2), securityLevel)
	if err != nil {
		return err
	}

	seed := calculateSeed(N, aux, securityLevel, "COIN_COMMITMENT_GROUP")

	params.CoinCommitmentGroup, err = deriveIntegerGroupParams(&seed, pLen, qLen)
	if err != nil {
		return err
	}

	params.SerialNumberSoKCommitmentGroup, err = deriveIntegerGroupFromOrder(params.CoinCommitmentGroup.Modulus)
	if err != nil {
		return err
	}

	newSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_INTERNAL_COMMITMENT_GROUP")

	params.AccumulatorParams.AccumulatorPoKCommitmentGroup, err = deriveIntegerGroupParams(&newSeed, qLen+300, qLen+1)
	if err != nil {
		return err
	}

	qrnCommitmentGroupGSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_QRN_COMMITMENT_GROUPG")
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G, _ = generateIntegerFromSeed(uint32(l-1), &qrnCommitmentGroupGSeed)
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G.Exp(params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G, big.NewInt(2), N)

	qrnCommitmentGroupHSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_QRN_COMMITMENT_GROUPH")
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H, _ = generateIntegerFromSeed(uint32(l-1), &qrnCommitmentGroupHSeed)
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H.Exp(params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H, big.NewInt(2), N)

	constant := big.NewInt(31)
	params.AccumulatorParams.AccumulatorBase = new(big.Int).Exp(constant, big.NewInt(2), params.AccumulatorParams.AccumulatorModulus)

	params.AccumulatorParams.MaxCoinValue = params.CoinCommitmentGroup.Modulus
	params.AccumulatorParams.MinCoinValue = new(big.Int).Exp(big.NewInt(2), big.NewInt(int64((params.CoinCommitmentGroup.Modulus.BitLen()/2)+3)), nil)

	params.AccumulatorParams.Initialized = true
	params.Initialized = true

	return nil
}
// calculateParams fills a params object deterministically given an RSA
// modulus N.
calculateParams fills a params object deterministically given an RSA
modulus N.
// calculateParams fills a params object deterministically given an RSA // modulus N .
func calculateParams(N *big.Int, aux string, securityLevel uint32, params *Params) error {
	params.Initialized = false
	params.AccumulatorParams.Initialized = false
	l := N.BitLen()
	if l < 1023 {
		return errors.New("Modulus must be at least 1023 bits")
	}
	if securityLevel < 80 {
		return errors.New("Security level must be at least 80 bits")
	}
	params.AccumulatorParams.AccumulatorModulus = N
	pLen, qLen, err := calculateGroupParamLengths(uint32(l-2), securityLevel)
	if err != nil {
		return err
	}
	seed := calculateSeed(N, aux, securityLevel, "COIN_COMMITMENT_GROUP")
	params.CoinCommitmentGroup, err = deriveIntegerGroupParams(&seed, pLen, qLen)
	if err != nil {
		return err
	}
	params.SerialNumberSoKCommitmentGroup, err = deriveIntegerGroupFromOrder(params.CoinCommitmentGroup.Modulus)
	if err != nil {
		return err
	}
	newSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_INTERNAL_COMMITMENT_GROUP")
	params.AccumulatorParams.AccumulatorPoKCommitmentGroup, err = deriveIntegerGroupParams(&newSeed, qLen+300, qLen+1)
	if err != nil {
		return err
	}
	qrnCommitmentGroupGSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_QRN_COMMITMENT_GROUPG")
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G, _ = generateIntegerFromSeed(uint32(l-1), &qrnCommitmentGroupGSeed)
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G.Exp(params.AccumulatorParams.AccumulatorQRNCommitmentGroup.G, big.NewInt(2), N)
	qrnCommitmentGroupHSeed := calculateSeed(N, aux, securityLevel, "ACCUMULATOR_QRN_COMMITMENT_GROUPH")
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H, _ = generateIntegerFromSeed(uint32(l-1), &qrnCommitmentGroupHSeed)
	params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H.Exp(params.AccumulatorParams.AccumulatorQRNCommitmentGroup.H, big.NewInt(2), N)
	constant := big.NewInt(31)
	params.AccumulatorParams.AccumulatorBase = new(big.Int).Exp(constant, big.NewInt(2), params.AccumulatorParams.AccumulatorModulus)
	params.AccumulatorParams.MaxCoinValue = params.CoinCommitmentGroup.Modulus
	params.AccumulatorParams.MinCoinValue = new(big.Int).Exp(big.NewInt(2), big.NewInt(int64((params.CoinCommitmentGroup.Modulus.BitLen()/2)+3)), nil)
	params.AccumulatorParams.Initialized = true
	params.Initialized = true
	return nil
}
func calculateParams ( N * big . Int , aux string , securityLevel uint32 , params * Params ) error { params . Initialized = false params . AccumulatorParams . Initialized = false l := N . BitLen ( ) if l < 1023 { return errors . New ( " " ) } if securityLevel < 80 { return errors . New ( " " ) } params . AccumulatorParams . AccumulatorModulus = N pLen , qLen , err := calculateGroupParamLengths ( uint32 ( l - 2 ) , securityLevel ) if err != nil { return err } seed := calculateSeed ( N , aux , securityLevel , " " ) params . CoinCommitmentGroup , err = deriveIntegerGroupParams ( & seed , pLen , qLen ) if err != nil { return err } params . SerialNumberSoKCommitmentGroup , err = deriveIntegerGroupFromOrder ( params . CoinCommitmentGroup . Modulus ) if err != nil { return err } newSeed := calculateSeed ( N , aux , securityLevel , " " ) params . AccumulatorParams . AccumulatorPoKCommitmentGroup , err = deriveIntegerGroupParams ( & newSeed , qLen + 300 , qLen + 1 ) if err != nil { return err } qrnCommitmentGroupGSeed := calculateSeed ( N , aux , securityLevel , " " ) params . AccumulatorParams . AccumulatorQRNCommitmentGroup . G , _ = generateIntegerFromSeed ( uint32 ( l - 1 ) , & qrnCommitmentGroupGSeed ) params . AccumulatorParams . AccumulatorQRNCommitmentGroup . G . Exp ( params . AccumulatorParams . AccumulatorQRNCommitmentGroup . G , big . NewInt ( 2 ) , N ) qrnCommitmentGroupHSeed := calculateSeed ( N , aux , securityLevel , " " ) params . AccumulatorParams . AccumulatorQRNCommitmentGroup . H , _ = generateIntegerFromSeed ( uint32 ( l - 1 ) , & qrnCommitmentGroupHSeed ) params . AccumulatorParams . AccumulatorQRNCommitmentGroup . H . Exp ( params . AccumulatorParams . AccumulatorQRNCommitmentGroup . H , big . NewInt ( 2 ) , N ) constant := big . NewInt ( 31 ) params . AccumulatorParams . AccumulatorBase = new ( big . Int ) . Exp ( constant , big . NewInt ( 2 ) , params . AccumulatorParams . AccumulatorModulus ) params . AccumulatorParams . MaxCoinValue = params . CoinCommitmentGroup . Modulus params . AccumulatorParams . MinCoinValue = new ( big . Int ) . Exp ( big . NewInt ( 2 ) , big . NewInt ( int64 ( ( params . CoinCommitmentGroup . Modulus . BitLen ( ) / 2 ) + 3 ) ) , nil ) params . AccumulatorParams . Initialized = true params . Initialized = true return nil }
calculateParams fills a params object deterministically given an RSA
modulus N.
calculateParams fills a params object deterministically given an RSA modulus N .