From ae6a048de957054802268cb9e3e08e3dd81b7c5d Mon Sep 17 00:00:00 2001 From: Ashish Bhanu Daulatabad Date: Sun, 11 Apr 2021 00:13:13 +0530 Subject: [PATCH 1/2] Comment modification --- ciphers/elliptic_curve_key_exchange.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ciphers/elliptic_curve_key_exchange.cpp b/ciphers/elliptic_curve_key_exchange.cpp index a13450dbe..a4282a024 100644 --- a/ciphers/elliptic_curve_key_exchange.cpp +++ b/ciphers/elliptic_curve_key_exchange.cpp @@ -286,6 +286,7 @@ static void test() { std::cout << alice_shared_key << std::endl; std::cout << bob_shared_key << std::endl; + // Check whether shared keys are equal assert(alice_shared_key == bob_shared_key); } From 857bf97e4b0ba205864c8aff69abe2d18e6477a0 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 10 Apr 2021 18:44:33 +0000 Subject: [PATCH 2/2] clang-format and clang-tidy fixes for ae6a048d --- ciphers/uint128_t.hpp | 2 +- ciphers/uint256_t.hpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ciphers/uint128_t.hpp b/ciphers/uint128_t.hpp index fb9793b30..993ef6683 100644 --- a/ciphers/uint128_t.hpp +++ b/ciphers/uint128_t.hpp @@ -97,7 +97,7 @@ class uint128_t { */ template ::value, T>::type> - explicit uint128_t(T low) : s(low), f(0) {} + explicit uint128_t(T low) : s(low) {} /** * @brief Parameterized constructor diff --git a/ciphers/uint256_t.hpp b/ciphers/uint256_t.hpp index 4da1f35e9..3c7b75d25 100644 --- a/ciphers/uint256_t.hpp +++ b/ciphers/uint256_t.hpp @@ -198,7 +198,7 @@ class uint256_t { */ inline uint256_t operator+(const uint256_t &p) { bool app = s + p.s < s; - return uint256_t(f + app + p.f, p.s + s); + return {f + app + p.f, p.s + s}; } /** @@ -266,7 +266,7 @@ class uint256_t { */ inline uint256_t operator-(const uint256_t &p) { bool app = p.s > s; - return uint256_t(f - p.f - app, s - p.s); + return {f - p.f - app, s - p.s}; } /** @@ -346,8 +346,8 @@ class uint256_t { int cc = (tmp + tmp2 < tmp); tmp += tmp2; cc += (tmp + fo < tmp); - return uint256_t(f * p.s + s * p.f + fi + se.upper() + th.upper() + cc, - tmp + fo); + return {f * p.s + s * p.f + fi + se.upper() + th.upper() + cc, + tmp + fo}; } /** @@ -590,13 +590,13 @@ class uint256_t { } // Bitwise operators - inline uint256_t operator~() { return uint256_t(~f, ~s); } + inline uint256_t operator~() { return {~f, ~s}; } template ::value, T>::type> uint256_t operator<<(const T &p) { if (!p) { - return uint256_t(this->f, this->s); + return {this->f, this->s}; } else if (p >= 128) { return uint256_t((this->s << (p - 128)), uint128_t(0)); } @@ -623,7 +623,7 @@ class uint256_t { std::is_integral::value, T>::type> uint256_t operator>>(const T &p) { if (!p) { - return uint256_t(this->f, this->s); + return {this->f, this->s}; } else if (p >= 128) { return uint256_t(uint128_t(0), (this->f >> (p - 128))); } @@ -653,7 +653,7 @@ class uint256_t { } inline uint256_t operator&(const uint256_t &p) { - return uint256_t(f & p.f, s & p.s); + return {f & p.f, s & p.s}; } inline uint256_t &operator&=(const uint256_t &p) { @@ -676,7 +676,7 @@ class uint256_t { } inline uint256_t operator|(const uint256_t &p) { - return uint256_t(this->f | p.f, this->s | p.s); + return {this->f | p.f, this->s | p.s}; } template f ^ p.f, this->s ^ p.s); + return {this->f ^ p.f, this->s ^ p.s}; } inline uint256_t &operator^=(const uint256_t &p) {