Commit graph

23 commits

Author SHA1 Message Date
Helder Eijs
88595c6fa3 Remove OverflowError from right shift 2018-01-08 12:01:49 +01:00
Helder Eijs
7d03599c65 Fix Integer.get_bit for negative values and overflows
It is not possible anymore to get a specific bit from a negative
integer (representation cannot be intuitive).

OverFlowError is not raised anymore (in line with
https://bugs.python.org/issue29816)
2018-01-08 11:49:10 +01:00
Legrandin
e7112fa9d4 Add Math.Integer.size_in_bytes 2016-01-26 04:47:29 -05:00
Legrandin
c0176c8d32 Add in-place invert operation 2016-01-11 22:55:39 +01:00
Legrandin
92cbf23eba Added in-place subtraction 2016-01-11 22:35:45 +01:00
Legrandin
8b15b12a81 Add in-place exponentiation for Integer 2016-01-11 08:33:00 +01:00
Legrandin
1cca0ff6c1 Add Integer.lcm() method 2015-03-05 21:54:07 +01:00
Legrandin
f928741c77 Add square root to Integer 2015-02-25 22:39:10 +01:00
Legrandin
eb49715608 pow(), gcd() and inverse() methods return Integer
The three functions erroneously return a Python
integer and not an Crypto.Number.Integer when
using the fallback implementation (non-GMP).
2015-02-03 21:55:25 +01:00
Legrandin
40fe460735 Added inverse, gcd, left shift and floor division to Integer 2014-12-06 12:04:11 +01:00
Legrandin
354ed29fba Revisited tests, docs and added generate_probable_safe_prime 2014-12-06 12:04:11 +01:00
Legrandin
7efa10ed59 Additional optimizations for prime generation. 2014-12-06 12:04:11 +01:00
Legrandin
1c609d77c6 More complete set of tests for Math.Number 2014-12-06 12:04:11 +01:00
Legrandin
6f28a6007d Optimize prime generation (Lucas test) 2014-12-06 12:04:11 +01:00
Legrandin
e6771764de Add is_divisible_by_ulong method to Integer 2014-12-06 12:04:11 +01:00
Legrandin
6f6bfe785a Add or operator to Integer 2014-12-06 12:04:11 +01:00
Legrandin
2e40ae0f14 Change Math.Numbers.Natural into Integer 2014-12-06 12:04:10 +01:00
Legrandin
81e9b240a0 Added more methods to Natural.
Methods and operators added are:
* jacobi_symbol()
* multiplication
* simple exponentiation
* right shift
2014-12-06 12:04:10 +01:00
Legrandin
8847d4b700 Add is_perfect_square method to Natural 2014-12-06 12:04:10 +01:00
Legrandin
36bec9d410 Added more methods to Natural
Methods and operators added:
* random()
* and
* comparison
* bool
* in-place right shift
* size_in_bits()
* str
* is_even()
* is_odd()
2014-12-06 12:04:10 +01:00
Legrandin
1b6ad42925 Added exponentiation to Natural 2014-12-06 12:04:10 +01:00
Legrandin
87e2f82965 Initial support for GMP 2014-12-06 12:04:10 +01:00
Legrandin
6f310bc021 First implementation based on int 2014-12-06 12:04:10 +01:00