• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Aug 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. class jist1024:
2.     def __init__(self, data: bytes, salt=None):
3.         self.data = data
4.         self.salt = salt
5.
6.     def digest(self):
9.
10.         if self.salt and self.__check_salt():
11.             current = self.salt
12.
13.         for x in range(0, len(padded), 1024):
15.
16.             for i in range(4):
17.                 mat = self.__rotate([[((mat[x][y] << 16) ^ current) >> 16 for y in range(32)] for x in range(32)])
18.                 number = sum([sum([self.__secr(mat[x][y], (y*x) % 20) for y in range(32)]) for x in range(32)])
19.                 current = self.__inverse(current ^ number)
20.
21.         return current
22.
23.     def hexdigest(self):
24.         return "{0:x}".format(self.digest())
25.
26.     def __inverse(self, number):
27.         d = str(number)
28.         g = len(d) - 1
29.         return int("".join([d[g-x] for x in range(0, g)]))
30.
31.     def __check_salt(self):
32.         return self.salt > int("f"*511, 16)
33.
34.     def __secr(self, x, y):
35.         return ((x >> y) | (x << (64-y))) & 0xFFFFFFFFFFFFFFFF
36.
37.     def __xor(self, mat1: list, mat2: list):
38.         return [[mat1[x][y] ^ mat2[x][y] for y in range(32)] for x in range(32)]
39.
40.     def __rotate(self, data: list):
41.         return list(zip(*reversed(data)))
42.
43.     def __matrix(self, data: bytes):
44.         matrix = [[0 for y in range(32)] for x in range(32)]
45.         for a in range(0, 1024, 32):
46.             piece = data[a:a+32]
47.             matrix[a // 32] = [x for x in piece]
48.         return matrix
49.