xtn-tools-pro 1.0.0.0.3__py3-none-any.whl → 1.0.0.0.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- xtn_tools_pro/tools.py +32 -7
- {xtn_tools_pro-1.0.0.0.3.dist-info → xtn_tools_pro-1.0.0.0.4.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.0.0.3.dist-info → xtn_tools_pro-1.0.0.0.4.dist-info}/RECORD +6 -6
- {xtn_tools_pro-1.0.0.0.3.dist-info → xtn_tools_pro-1.0.0.0.4.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.0.0.3.dist-info → xtn_tools_pro-1.0.0.0.4.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.0.0.3.dist-info → xtn_tools_pro-1.0.0.0.4.dist-info}/top_level.txt +0 -0
xtn_tools_pro/tools.py
CHANGED
@@ -37,25 +37,54 @@ def get_md5_16(s, is_upper=False):
|
|
37
37
|
return result[8:24]
|
38
38
|
|
39
39
|
|
40
|
-
def
|
40
|
+
def get_binary_content_md5_32(content, is_upper=False):
|
41
|
+
"""
|
42
|
+
二进制内容md5 例如图片
|
43
|
+
:param content: 二进制内容
|
44
|
+
:param is_upper: 是否转大写 默认False
|
45
|
+
:return:
|
46
|
+
"""
|
47
|
+
md5_hash = hashlib.md5(content)
|
48
|
+
md5_hexdigest = md5_hash.hexdigest()
|
49
|
+
if is_upper:
|
50
|
+
return md5_hexdigest.upper()
|
51
|
+
return md5_hexdigest
|
52
|
+
|
53
|
+
|
54
|
+
def get_binary_content_md5_16(content, is_upper=False):
|
55
|
+
"""
|
56
|
+
二进制内容md5 例如图片
|
57
|
+
:param content: 二进制内容
|
58
|
+
:param is_upper: 是否转大写 默认False
|
59
|
+
:return:
|
60
|
+
"""
|
61
|
+
result = get_binary_content_md5_32(content, is_upper)
|
62
|
+
return result[8:24]
|
63
|
+
|
64
|
+
|
65
|
+
def get_file_md5_32(file_path, is_upper=False):
|
41
66
|
"""
|
42
67
|
获取文件md5值
|
43
68
|
:param file_path: 文件路径
|
69
|
+
:param is_upper: 是否转大写 默认False
|
44
70
|
:return:
|
45
71
|
"""
|
46
72
|
with open(file_path, 'rb') as file:
|
47
73
|
data = file.read()
|
48
74
|
md5_hash = hashlib.md5(data).hexdigest()
|
75
|
+
if is_upper:
|
76
|
+
return md5_hash.upper()
|
49
77
|
return md5_hash
|
50
78
|
|
51
79
|
|
52
|
-
def get_file_md5_16(file_path):
|
80
|
+
def get_file_md5_16(file_path, is_upper=False):
|
53
81
|
"""
|
54
82
|
获取文件md5值
|
55
83
|
:param file_path: 文件路径
|
84
|
+
:param is_upper: 是否转大写 默认False
|
56
85
|
:return:
|
57
86
|
"""
|
58
|
-
result = get_file_md5_32(file_path)
|
87
|
+
result = get_file_md5_32(file_path, is_upper)
|
59
88
|
return result[8:24]
|
60
89
|
|
61
90
|
|
@@ -100,9 +129,5 @@ def get_calculate_total_page(total, limit):
|
|
100
129
|
return total_pages
|
101
130
|
|
102
131
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
132
|
if __name__ == '__main__':
|
108
133
|
pass
|
@@ -1,5 +1,5 @@
|
|
1
1
|
xtn_tools_pro/__init__.py,sha256=26Tf9j2wj88M1Ldg3b1DJ40KyGgN9ZmQdBLuV453388,395
|
2
|
-
xtn_tools_pro/tools.py,sha256
|
2
|
+
xtn_tools_pro/tools.py,sha256=-EeI_T7jEccapvZ6Jz25Ta0SIunqqcvDSWP2qn5b4aU,3502
|
3
3
|
xtn_tools_pro/tools_flie.py,sha256=B_P3J_R-nRLt_IFutnOVrBRGf6_SZ_cXoIoeaT9B7tk,1512
|
4
4
|
xtn_tools_pro/tools_time.py,sha256=DMjsw9h4E_mrPsanPA8CEhpUE1AA6Z2FU4OJqJKZc1k,4867
|
5
5
|
xtn_tools_pro/db/MongoDB.py,sha256=_GiX1MHNl9CtI-uLDgY_NmMSvRJei-mtKq3Hhe6ly1E,5567
|
@@ -7,8 +7,8 @@ xtn_tools_pro/db/RedisDB.py,sha256=ep32Yj8AAkUHRshSBhKsdl06UwO7Z-gQJLaezspVRKw,6
|
|
7
7
|
xtn_tools_pro/db/__init__.py,sha256=Zg91UWS02TO0Ba_0AY56s0oabRy93xLNFkpIIL_6mMM,416
|
8
8
|
xtn_tools_pro/proxy/XiaoXiangProxy.py,sha256=xrEBJZ6Cjuh6IBZVB17oXHwByaeKcWVUSSWSg17tujE,9842
|
9
9
|
xtn_tools_pro/proxy/__init__.py,sha256=WRwh6s2lruMu5buh0ejo9EK54kWT_VQhCsFGNFAmcyo,418
|
10
|
-
xtn_tools_pro-1.0.0.0.
|
11
|
-
xtn_tools_pro-1.0.0.0.
|
12
|
-
xtn_tools_pro-1.0.0.0.
|
13
|
-
xtn_tools_pro-1.0.0.0.
|
14
|
-
xtn_tools_pro-1.0.0.0.
|
10
|
+
xtn_tools_pro-1.0.0.0.4.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
xtn_tools_pro-1.0.0.0.4.dist-info/METADATA,sha256=nLLM4xF-cM4V6dqxghgyDjq6B2BAqHm0jI07PIuflQU,358
|
12
|
+
xtn_tools_pro-1.0.0.0.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
13
|
+
xtn_tools_pro-1.0.0.0.4.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
14
|
+
xtn_tools_pro-1.0.0.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|