mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Feat: Elliptic Curve Diffie Hellman Key Exchange, Ciphers: Error handling
This commit is contained in:
parent
3cfa917e5e
commit
82cfa17a58
@ -439,9 +439,9 @@ class uint128_t {
|
|||||||
*/
|
*/
|
||||||
std::pair<uint128_t, uint128_t> divide(const uint128_t &p) {
|
std::pair<uint128_t, uint128_t> divide(const uint128_t &p) {
|
||||||
if (*this < p) { // if this is less than divisor
|
if (*this < p) { // if this is less than divisor
|
||||||
return {uint128_t(0ULL), *this};
|
return {uint128_t(0), *this};
|
||||||
} else if (*this == p) { // if this is equal to divisor
|
} else if (*this == p) { // if this is equal to divisor
|
||||||
return {uint128_t(1ULL), uint128_t(0ULL)};
|
return {uint128_t(1), uint128_t(0)};
|
||||||
}
|
}
|
||||||
uint128_t tmp = p, tmp2 = *this;
|
uint128_t tmp = p, tmp2 = *this;
|
||||||
uint16_t left = tmp._lez() - _lez();
|
uint16_t left = tmp._lez() - _lez();
|
||||||
|
@ -433,9 +433,9 @@ class uint256_t {
|
|||||||
*/
|
*/
|
||||||
std::pair<uint256_t, uint256_t> divide(const uint256_t &p) {
|
std::pair<uint256_t, uint256_t> divide(const uint256_t &p) {
|
||||||
if (*this < p) { // if this is less than divisor
|
if (*this < p) { // if this is less than divisor
|
||||||
return {uint256_t(0ULL), *this};
|
return {uint256_t(0), *this};
|
||||||
} else if (*this == p) { // if this is equal to divisor
|
} else if (*this == p) { // if this is equal to divisor
|
||||||
return {uint256_t(1ULL), uint256_t(0ULL)};
|
return {uint256_t(1), uint256_t(0)};
|
||||||
}
|
}
|
||||||
uint256_t tmp = p, tmp2 = *this;
|
uint256_t tmp = p, tmp2 = *this;
|
||||||
uint16_t left = tmp._lez() - _lez();
|
uint16_t left = tmp._lez() - _lez();
|
||||||
|
Loading…
Reference in New Issue
Block a user