xtn-tools-pro 1.0.0.0.3__py3-none-any.whl → 1.0.0.0.4__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.
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 get_file_md5_32(file_path):
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtn-tools-pro
3
- Version: 1.0.0.0.3
3
+ Version: 1.0.0.0.4
4
4
  Summary: xtn 开发工具
5
5
  Author: xtn
6
6
  Author-email: czw011122@163.com
@@ -1,5 +1,5 @@
1
1
  xtn_tools_pro/__init__.py,sha256=26Tf9j2wj88M1Ldg3b1DJ40KyGgN9ZmQdBLuV453388,395
2
- xtn_tools_pro/tools.py,sha256=e9KSPqaFBIptBGvexShCcn0nZmUQ5omlVwXgEfWZf5Y,2630
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.3.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- xtn_tools_pro-1.0.0.0.3.dist-info/METADATA,sha256=VG4Bs3muLvi85SaWcP3Tw3q4TFfafKDtZhbQ-x9CpRw,358
12
- xtn_tools_pro-1.0.0.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
13
- xtn_tools_pro-1.0.0.0.3.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
14
- xtn_tools_pro-1.0.0.0.3.dist-info/RECORD,,
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,,