apply SHA256 hashing to a string to get a hash in base4 and of a specified size
a basic hash is 64 long (base 16); so 128 long when reduced to base 4
we count the needed number of basic hash to get to the wanted hash size / 2, because the size of the hash will be doubled in base 4
then the input string is hashed with a "A" +k added at the end ( k is an incremented hash_number)
the multiples hash are then concatenated to have a total hash of the wanted size /2 (rounded up to 64)
the total hash is then reduced in base 4, and brought to the exact wanted size
SHA256 hashing, result is in base 16
"""
hash_number=(hash_size/2)//64+1
total_hash=""
forkinrange(int(hash_number)):
# hash the string with a "A" and a number added, the A is to avoid getting the same hash for different strings
# ex : hashing input = "a" with k = 10 equals hashing "a10"; but hashing input = "a1" with k = 0 is also equals hashing "a10"
# here we will get the hashing of "aA10" and "a1A0", so completely different results
# even if the total hashing cannot be the same, we try to avoid having some k_hash parts (of size 128) that are exactly the same between two different total hashes
# even if the total hashing cannot be the same, we try to avoid having some k_hash parts (of size 128) that are exactly the same between two different total hashes