You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
655 B

  1. import math
  2. def renderPassword(mdp, quotient, alphabet):
  3. if len(mdp) > 14:
  4. return mdp
  5. quotient, remainder = divmod(quotient, len(alphabet))
  6. mdp += alphabet[remainder]
  7. return renderPassword(mdp, quotient, alphabet)
  8. alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
  9. print(renderPassword('', int('dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e', 16), alphabet))
  10. max_length = math.floor(math.log(int('dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e', 16))/math.log(26 + 26 + 10 + 32)) - 4
  11. print('max number of char for password with 32 bytes entropy: %d' % max_length)