Example #1
0
 def encode(self,  s):
     z = len(s) // self.split_size
     z += 1 if len(s) % self.split_size else 0
     bitesize = self.max_len * 2 * self.split_size
     sec = pgpu.section(s[:bitesize], self.split_size)
     l = self.mag_num * z
     r = int(''.join([str(hash(s) * l).replace('-', str(self.dash)
             ) for s in sec]))
     return sane_hex(r)[:self.max_len]
Example #2
0
 def encode(self, s):
     l = int(dec(len(s)) * self.mag_num)
     res = [str(ord(c) * l) for c in s]
     # how slow will this make this hasher?
     decimal.getcontext().prec = 77
     d = dec(''.join(res)).rotate(-1)
     return sane_hex(d)[:self.max_len]
Example #3
0
 def encode(self, s):
     z = len(s) // self.split_size
     z += 1 if len(s) % self.split_size else 0
     bitesize = self.max_len * 2 * self.split_size
     sec = pgpu.section(s[:bitesize], self.split_size)
     end = s[bitesize:]
     end36 = pgpu.keep_many(end, string.ascii_letters + string.digits)
     q = int(end36, 36) if end36 else 0
     ds = int(self.dash)
     if q < ds * 2 // 3 or not q or q < 0:
         q = ds
     l = self.mag_num * z * q
     v = ''.join([str(hash(end))] + [str(hash(s) * l
             ).replace('-', self.dash) for s in sec])
     r = int(v)
     return sane_hex(r)[:self.max_len]
Example #4
0
 def encode(self, s):
     l = int(dec(len(s)) * self.mag_num)
     res = ''.join([str(hash(c) * l) for c in s]).replace('-', '56')
     # Is speed going to be a problem here?
     decimal.getcontext().prec = 116
     d = dec(res).rotate(-2)
     return sane_hex(d)[:self.max_len]
Example #5
0
def multi_pass(user, pswd, times=1000, hasher=SHA512()):
    '''
    AUTHORS:
    v0.2.0+         --> pydsigner
    '''
    for i in range(0, times):
        pswd = hasher.encode(pswd + user + str(i))
    return pswd
Example #6
0
def rand_key(l = 10):
    '''
    AUTHORS:
    v0.2.0+         --> pydsigner
    '''
    res = ''
    while len(res) < l:
        v = str(math.log((random.randint(1, 33) * math.pi) ** 2))
        res += pgpu.remove_many(v, 'e-.')
    return res[:l]
Example #7
0
 def encode(self, s):
     l = int(len(s) * self.mag_num)
     res = [str(ord(c) * l) for c in s]
     return ''.join(res)[:self.max_len]
Example #8
0
 def encode(self, s):
     return '.'.join([str(ord(c) * 3) for c in s])
Example #9
0
 def encode(self, s):
     random.seed(s)
     return str(random.randint(self.small, self.big))
Example #10
0
 def encode(self, s):
     l = self.mag_num * len(s)
     r = int(str(hash(s) * l).replace('-', str(self.max_len)))
     return sane_hex(r)[:self.max_len]