From 76ab237717bac6a21943190b9a8206cbc6d41502 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Fri, 29 Sep 2023 02:34:46 +0800 Subject: [PATCH] 0.0.177 --- API_Reference/API_Reference.py | 6 ++++++ Source_Code/PyPI/setup.cfg | 2 +- Source_Code/PyPI/src/guan.egg-info/PKG-INFO | 2 +- Source_Code/PyPI/src/guan/__init__.py | 20 +++++++++++++++++++- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/API_Reference/API_Reference.py b/API_Reference/API_Reference.py index 91eb559..e4641c6 100644 --- a/API_Reference/API_Reference.py +++ b/API_Reference/API_Reference.py @@ -494,6 +494,12 @@ hex = guan.rgb_to_hex(rgb, pound=1) # 将HEX转成RGB rgb = guan.hex_to_rgb(hex) +# 使用MD5进行散列加密 +hashed_password = guan.encryption_MD5(password, salt='') + +# 使用SHA-256进行散列加密 +hashed_password = guan.encryption_SHA_256(password, salt='') + # Module 13: file processing diff --git a/Source_Code/PyPI/setup.cfg b/Source_Code/PyPI/setup.cfg index 27e3b80..1b864c3 100644 --- a/Source_Code/PyPI/setup.cfg +++ b/Source_Code/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.0.176 +version = 0.0.177 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/Source_Code/PyPI/src/guan.egg-info/PKG-INFO b/Source_Code/PyPI/src/guan.egg-info/PKG-INFO index 48c89c1..e761696 100644 --- a/Source_Code/PyPI/src/guan.egg-info/PKG-INFO +++ b/Source_Code/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.0.176 +Version: 0.0.177 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/Source_Code/PyPI/src/guan/__init__.py b/Source_Code/PyPI/src/guan/__init__.py index cc95fac..94bae9f 100644 --- a/Source_Code/PyPI/src/guan/__init__.py +++ b/Source_Code/PyPI/src/guan/__init__.py @@ -2,7 +2,7 @@ # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. -# The current version is guan-0.0.176, updated on September 14, 2023. +# The current version is guan-0.0.177, updated on September 29, 2023. # Installation: pip install --upgrade guan @@ -2858,6 +2858,24 @@ def hex_to_rgb(hex): length = len(hex) return tuple(int(hex[i:i+length//3], 16) for i in range(0, length, length//3)) +# 使用MD5进行散列加密 +def encryption_MD5(password, salt=''): + import hashlib + password = salt+password + hashed_password = hashlib.md5(password.encode()).hexdigest() + return hashed_password + +# 使用SHA-256进行散列加密 +def encryption_SHA_256(password, salt=''): + import hashlib + password = salt+password + print(password) + hashed_password = hashlib.sha256(password.encode()).hexdigest() + return hashed_password + + + +