- Modified
setup.py
to no longer read fromREADME.md
andHISTORY.md
as it was causing errors when installing from PyPi.
pip install basehash
giving error. Corrected this insetup.py
-
Massive overhaul on the primes.py methods. Each method was benchmarked to get the best optimization possible.
-
Uses gmpy2 if available, otherwise use the baillie_psw primality check and the next_prime methods in primes.py
-
base.hash()
no longer accepts argumentlength
. One instance per hash length. -
base.maximum()
,base.maximum_value()
, andbase.prime()
have been removed. To get maximum hash value, callbase.maximum
. To get the prime used callbase.prime
-
primes.miller_rabin
was removed as it was replaced byprimes.baillie_psw
in v1.0.2.
- Implemented six to allow use of
xrange
in Python 2 andrange
in Python 3
- Fixed ussues with python 3.4
-
Create custom random alphabets using
basehash.generate_alphabet(alphabet)
. -
BaseHash.base now checks
alphabet
for duplicates usingset
.
- base and baseN now accept a length parameter, defaulted to HASH_LENGTH so that baseN.hash(num, length) is set globally, not locally.
- Moved everything to an object. Removed baseN.py files, allows for easier
configuration of
GENERATOR
and for extending to a custom alphabet.
-
There was an issue with hashes sometimes being returned one to two charcters shorter than
length
, causingbase.base_unhash
to not function properly. To fix this, the hashes are right-padded withalphabet[0]
. -
Since
0
raises an error insideprimes.invmul
,base.base_unhash
is unable to unhash it. To allow the start of your number sequence to be0
instead of1
, if needed, hashingbase.base_hash(0, length=6)
will return''.rjust(length, alphabet[0])
.
- Fixed issues with setup.py. First time using a setup.py within a package, first time publishing the library outside of GitHub.
- Added nose unittests.
- Added setup.py, LICENSE, HISTORY.rst, and .travis.yaml.
-
Added a simple test for
prime < 31
to reduce calculation time. -
Fixed issue of
strong_pseudoprime(n, 3)
giving false results.
-
Changed primality test from Miller-Rabin to Baillie-PSW. This algorithm is significantly faster.
-
Changed determination to use
sqrt(n)
orisqrt(n)
to an improved version ofisqrt(n)
. -
BaseHash is now PEP compliant.
- Changed primality test from Fermat to Miller-Rabin. Improved accuracy on false results when it comes to pseudoprimes.
- Released code to GitHub repository python-basehash https://github.com/bnlucas/python-basehash
- Initialization