• 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):
8.         current = 0xb614f18875932ca106301dc1837c3e62bbd52978b79ac25ac2d7e24abd0c5a36235159447bf0c1b5a9c5fc7e6b9d6e526a9189eab96911953cc673351822a72bf1bc804261cb1fbd0f26b83177ce3d3655a54270bab3a6f1c1f1100ccf769760cddcb40c07a50bd044adae1f1c3ea8c5e602272784cbd47a1d8793d89d1c079c
9.
10.         if self.salt and self.__check_salt():
11.             current = self.salt
12.
13.         for x in range(0, len(padded), 1024):
14.             mat = self.__matrix(padded[x:x+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.
50.     def __padding(self, data: bytes):
51.         while len(data) % 1024:
52.             data += b'\x00'
53.         return data
54.
55.     def __print(self, matrix: list):
56.         print('\n'.join([' '.join([str(y).rjust(3, '0') for y in x]) for x in matrix]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!

Top