rename order flag to modulus

This commit is contained in:
filifa 2025-09-10 18:56:03 -04:00
parent c9cb78428f
commit 0fdc6f6e6c
1 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ import (
) )
// FIXME: order and generator may not be the right names here // FIXME: order and generator may not be the right names here
var discreteLogOrder string var discreteLogModulus string
var discreteLogGenerator string var discreteLogGenerator string
var discreteLogElement string var discreteLogElement string
@ -72,9 +72,9 @@ func babyStepGiantStep(n, g, x *big.Int) *big.Int {
} }
func discreteLog(cmd *cobra.Command, args []string) { func discreteLog(cmd *cobra.Command, args []string) {
n, ok := new(big.Int).SetString(discreteLogOrder, 10) n, ok := new(big.Int).SetString(discreteLogModulus, 10)
if !ok { if !ok {
cobra.CheckErr("invalid order " + discreteLogOrder) cobra.CheckErr("invalid modulus " + discreteLogModulus)
} }
g, ok := new(big.Int).SetString(discreteLogGenerator, 10) g, ok := new(big.Int).SetString(discreteLogGenerator, 10)
@ -112,8 +112,8 @@ func init() {
// is called directly, e.g.: // is called directly, e.g.:
// discreteLogCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") // discreteLogCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
discreteLogCmd.Flags().StringVarP(&discreteLogOrder, "order", "n", "", "order of the cyclic group") discreteLogCmd.Flags().StringVarP(&discreteLogModulus, "modulus", "m", "", "modulus of the cyclic group")
discreteLogCmd.MarkFlagRequired("order") discreteLogCmd.MarkFlagRequired("modulus")
discreteLogCmd.Flags().StringVarP(&discreteLogGenerator, "generator", "g", "", "generator of the cyclic group") discreteLogCmd.Flags().StringVarP(&discreteLogGenerator, "generator", "g", "", "generator of the cyclic group")
discreteLogCmd.MarkFlagRequired("generator") discreteLogCmd.MarkFlagRequired("generator")