Ejemplo n.º 1
0
 def __init__(self,key):
     key = cryptutils.convertInput(key,['upper','nospace','charonly'])
     #first, make sure that the key has no repeated letters
     if len(cryptutils.unique(key)) != len(key):
         raise ValueError,'Key must not have any repeated characters.'
     #next, figure out the sort order of the letters in the key
     keylist = list(key)
     keylist.sort()
     keyorder = []
     for ch in key:
         keyorder.append(keylist.index(ch))
     
     #make that list of key orders the key
     self.key = keyorder
Ejemplo n.º 2
0
 def __init__(self,key):
     key = cryptutils.unique(cryptutils.convertInput(key,['upper','nospace','charonly']))
     if len(key) > 25:
         raise ValueError,'Key Length must be 25 characters or less.'
     remchars = 25 - len(key)
     keylist = list(key)
     for ch in ascii_uppercase:
         if ch == 'J':
             continue
         if ch not in key:
             keylist.append(ch)
     key = ''.join(keylist)
     self.key = []
     self.key.append(key[0:5])
     self.key.append(key[5:10])
     self.key.append(key[10:15])
     self.key.append(key[15:20])
     self.key.append(key[20:25])
Ejemplo n.º 3
0
 def __init__(self, key):
     key = cryptutils.unique(
         cryptutils.convertInput(key, ['upper', 'nospace', 'charonly']))
     if len(key) > 25:
         raise ValueError, 'Key Length must be 25 characters or less.'
     remchars = 25 - len(key)
     keylist = list(key)
     for ch in ascii_uppercase:
         if ch == 'J':
             continue
         if ch not in key:
             keylist.append(ch)
     key = ''.join(keylist)
     self.key = []
     self.key.append(key[0:5])
     self.key.append(key[5:10])
     self.key.append(key[10:15])
     self.key.append(key[15:20])
     self.key.append(key[20:25])