VirtualMailManager/VirtualMailManager.py
changeset 140 ffac064bd728
parent 138 617f27715b01
child 143 16542519a5a8
equal deleted inserted replaced
139:7f6911bd11cd 140:ffac064bd728
   368         from random import choice
   368         from random import choice
   369         salt = None
   369         salt = None
   370         if self.__scheme == 'CRYPT':
   370         if self.__scheme == 'CRYPT':
   371             salt = '%s%s' % (choice(SALTCHARS), choice(SALTCHARS))
   371             salt = '%s%s' % (choice(SALTCHARS), choice(SALTCHARS))
   372         elif self.__scheme in ['MD5', 'MD5-CRYPT']:
   372         elif self.__scheme in ['MD5', 'MD5-CRYPT']:
   373             salt = '$1$'
   373             salt = '$1$%s$' % ''.join([choice(SALTCHARS) for x in xrange(8)])
   374             for i in range(8):
       
   375                 salt += choice(SALTCHARS)
       
   376             salt += '$'
       
   377         return salt
   374         return salt
   378 
   375 
   379     def __pwCrypt(self, password):
   376     def __pwCrypt(self, password):
   380         # for: CRYPT, MD5 and MD5-CRYPT
   377         # for: CRYPT, MD5 and MD5-CRYPT
   381         from crypt import crypt
   378         from crypt import crypt