From 88640191e8099b23b5936d5eca33a6d584c56524 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 10 Jun 2023 20:52:32 +0300 Subject: [PATCH] get_rid_of_snake_case() --- src/cli.cpp | 16 ++++++++-------- src/cli.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index 40e5844..949eec1 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -170,7 +170,7 @@ int CLI::validateCommandLine(Options* options, char *argv[], json *keys) { return 0; } -void CLI::print_product_id(DWORD *pid) +void CLI::printID(DWORD *pid) { char raw[12]; char b[6], c[8]; @@ -200,11 +200,11 @@ void CLI::print_product_id(DWORD *pid) fmt::print("Product ID: PPPPP-{}-{}-23xxx\n", b, c); } -void CLI::print_product_key(char *pk) { +void CLI::printKey(char *pk) { assert(strlen(pk) == 25); std::string spk = pk; - fmt::print("{}-{}-{}-{}-{}", + fmt::print("{}-{}-{}-{}-{}\n", spk.substr(0,5), spk.substr(5,5), spk.substr(10,5), @@ -231,7 +231,7 @@ CLI::CLI(Options options, json keys) { if (options.verbose) { fmt::print("----------------------------------------------------------- \n"); - fmt::print("Loaded the following curve constraints: BINK[{}]\n", BINKID); + fmt::print("Loaded the following elliptic curve parameters: BINK[{}]\n", BINKID); fmt::print("----------------------------------------------------------- \n"); fmt::print(" P: {}\n", keys["BINK"][BINKID]["p"].get()); fmt::print(" a: {}\n", keys["BINK"][BINKID]["a"].get()); @@ -261,7 +261,7 @@ CLI::CLI(Options options, json keys) { } int CLI::BINK1998() { - DWORD nRaw = options.channelID * 1000000 ; /* <- change */ + DWORD nRaw = options.channelID * 1'000'000 ; /* <- change */ BIGNUM *bnrand = BN_new(); BN_rand(bnrand, 19, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY); @@ -284,8 +284,8 @@ int CLI::BINK1998() { for (int i = 0; i < total; i++) { BINK1998::Generate(eCurve, genPoint, genOrder, privateKey, nRaw, bUpgrade, pKey); - CLI::print_product_key(pKey); - fmt::print("\n\n"); + CLI::printKey(pKey); + fmt::print("\n"); // verify the key count += BINK1998::Verify(eCurve, genPoint, pubPoint, pKey); @@ -313,7 +313,7 @@ int CLI::BINK2002() { } BINK2002::Generate(eCurve, genPoint, genOrder, privateKey, pChannelID, pAuthInfo, false, pKey); - CLI::print_product_key(pKey); + CLI::printKey(pKey); fmt::print("\n\n"); // verify a key diff --git a/src/cli.h b/src/cli.h index 8602402..28cd6c0 100644 --- a/src/cli.h +++ b/src/cli.h @@ -24,8 +24,8 @@ public: static void showHelp(char *argv[]); static int parseCommandLine(int argc, char* argv[], Options *options); static int validateCommandLine(Options* options, char *argv[], json *keys); - static void print_product_id(DWORD *pid); - static void print_product_key(char *pk); + static void printID(DWORD *pid); + static void printKey(char *pk); int BINK1998(); int BINK2002();