aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/math.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/math.cpp')
-rw-r--r--src/cli/math.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cli/math.cpp b/src/cli/math.cpp
index f01d9a1bd..2f3339898 100644
--- a/src/cli/math.cpp
+++ b/src/cli/math.cpp
@@ -19,6 +19,16 @@ class Modular_Inverse final : public Command
public:
Modular_Inverse() : Command("mod_inverse n mod") {}
+ std::string group() const override
+ {
+ return "numtheory";
+ }
+
+ std::string description() const override
+ {
+ return "Calculates a modular inverse";
+ }
+
void go() override
{
const Botan::BigInt n(get_arg("n"));
@@ -35,6 +45,16 @@ class Gen_Prime final : public Command
public:
Gen_Prime() : Command("gen_prime --count=1 bits") {}
+ std::string group() const override
+ {
+ return "numtheory";
+ }
+
+ std::string description() const override
+ {
+ return "Samples one or more primes";
+ }
+
void go() override
{
const size_t bits = get_arg_sz("bits");
@@ -55,6 +75,16 @@ class Is_Prime final : public Command
public:
Is_Prime() : Command("is_prime --prob=56 n") {}
+ std::string group() const override
+ {
+ return "numtheory";
+ }
+
+ std::string description() const override
+ {
+ return "Test if the integer n is composite or prime";
+ }
+
void go() override
{
Botan::BigInt n(get_arg("n"));
@@ -76,6 +106,16 @@ class Factor final : public Command
public:
Factor() : Command("factor n") {}
+ std::string group() const override
+ {
+ return "numtheory";
+ }
+
+ std::string description() const override
+ {
+ return "Factor a given integer";
+ }
+
void go() override
{
Botan::BigInt n(get_arg("n"));