HWVL 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
HWVL/HWVL.py ADDED
@@ -0,0 +1,83 @@
1
+ from os import system, name
2
+
3
+ def clear_console():
4
+
5
+ if name == 'nt':
6
+ system('cls')
7
+ else:
8
+ system('clear')
9
+
10
+ def string_to_int(char):
11
+ return ord(char)
12
+
13
+ def int_to_string(Int):
14
+ printable_start = 33
15
+ printable_end = 126
16
+ range_size = printable_end - printable_start + 1
17
+ return chr(printable_start + (Int % range_size))
18
+
19
+ def shift_right(lst, shift):
20
+ shift = shift % len(lst)
21
+ return lst[-shift:] + lst[:-shift]
22
+
23
+ def calculate_column_wise_average(lst):
24
+ num_columns = len(lst[0])
25
+ return [round(sum(row[j] for row in lst) / len(lst)) for j in range(num_columns)]
26
+
27
+ def average_with_right(lst):
28
+
29
+ if len(lst) < 2:
30
+ return lst
31
+
32
+ new_lst = []
33
+
34
+ for i in range(len(lst) - 1):
35
+
36
+ avg = (lst[i] + lst[i + 1]) / 2
37
+ new_lst.append(avg)
38
+
39
+ avg_last_first = (lst[-1] + lst[0]) / 2
40
+ new_lst.append(avg_last_first)
41
+ return new_lst
42
+
43
+ def HWVL(text="",l=32):
44
+ if text=="":
45
+ return ""
46
+
47
+ while not len(text)%l==0:
48
+ text+="@"
49
+ b=[]
50
+
51
+ for a in range(len(text)//l):
52
+ li=[]
53
+ for i in list(text[a*l:(a+1)*l]):
54
+ li.append(string_to_int(i))
55
+ li=average_with_right(li)
56
+
57
+ for i in range(l):
58
+ li=shift_right(li,int(li[0]))
59
+ li.sort()
60
+ for i in range(len(li)-2):
61
+ li[i]=li[i]*li[i+1]/li[i+2]
62
+ li.reverse()
63
+ b.append(li)
64
+
65
+ output_list=calculate_column_wise_average(b)
66
+ output_text=""
67
+
68
+ for i in output_list:
69
+ output_text+=int_to_string(i)
70
+
71
+
72
+ return output_text
73
+
74
+ if __name__ == "__main__":
75
+ while True:
76
+ text=input(">>>")
77
+ if text=="exit":
78
+ break
79
+ elif text=="cls":
80
+ clear_console()
81
+ elif text!="":
82
+ Hash=HWVL(text)
83
+ print(Hash)
HWVL/__init__.py ADDED
@@ -0,0 +1 @@
1
+ import HWVL.HWVL as HWVL
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: HWVL
3
+ Version: 0.0.1
4
+ Summary: The first Iranian hash
5
+ Home-page: https://github.com/HWVL/hash-HWVL
6
+ Author: mohammad rakhshkhorshid
7
+ Author-email: mohammad.rakhshkhorshid@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: classifier
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: requires-python
19
+ Dynamic: summary
20
+
21
+ # HWVL Hash
22
+ HWVL Hash stands for "Hash with Variable Length."
23
+
24
+ Before we delve into explaining this algorithm, let's examine the characteristics of a hash.
25
+
26
+ # Main Features of Hash Algorithms
27
+
28
+ - The output length of a hash function or hash value is always fixed.
29
+ - As long as the input remains unchanged, the output of the hash function is deterministic and constant.
30
+ - The hash value is usually much smaller than the input. For this reason, hash functions are also referred to as compressors.
31
+ - The operation of a hash function differs from that of encryption.
32
+ - Hash functions are designed to be one-way.
33
+
34
+ # Innovation in Security
35
+ Our hash introduces an innovation in the world of security, as it takes two inputs in contrast to other algorithms, which are:
36
+
37
+ - The text we want to hash
38
+ - The length of the output
39
+
40
+ Increasing the output length slows down the process but enhances security; the larger this number, the lower the probability of the hash being compromised.
@@ -0,0 +1,6 @@
1
+ HWVL/HWVL.py,sha256=u1D-eIbplvRHx8p4x1qpGAlxpx0YtUjQTKvh8evU204,1937
2
+ HWVL/__init__.py,sha256=iyglV9h5Y2_b-socdKRUoV1T0e0svI75s3RDpPy8Tbo,24
3
+ hwvl-0.0.1.dist-info/METADATA,sha256=2At7DDPeyDRzt-wmAtYGTHDmEZBbgsgT8PeKFTzcIdQ,1550
4
+ hwvl-0.0.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
5
+ hwvl-0.0.1.dist-info/top_level.txt,sha256=gxNCWGIvbEqRWmPNZVPe0OOsP0VomtjCputhPd6dEZQ,5
6
+ hwvl-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (77.0.3)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ HWVL