Add examples for get digests

This commit is contained in:
Mauricio Baeza 2021-06-21 23:02:38 -05:00
parent 7a58bb695b
commit 4b9a5e45a5
2 changed files with 21 additions and 2 deletions

View File

@ -437,3 +437,17 @@ Execute `stop_clock` for stop timer.
21/06/2021 22:43:47 - DEBUG - 22:43:47.128487
21/06/2021 22:43:47 - INFO - Timer stopped... show_time
Get digest
^^^^^^^^^^
.. code-block:: bash
data = 'LibreOffice with Python'
digest = app.sha256(data)
app.msgbox(digest)
digest = app.sha512(data)
app.msgbox(digest)

View File

@ -687,6 +687,7 @@ def sha256(data):
result = hashlib.sha256(data.encode()).hexdigest()
return result
def sha512(data):
result = hashlib.sha512(data.encode()).hexdigest()
return result
@ -743,12 +744,16 @@ def render(template, data):
def get_size_screen():
res = ''
if IS_WIN:
user32 = ctypes.windll.user32
res = f'{user32.GetSystemMetrics(0)}x{user32.GetSystemMetrics(1)}'
else:
args = 'xrandr | grep "*" | cut -d " " -f4'
res = run(args, split=False)
try:
args = 'xrandr | grep "*" | cut -d " " -f4'
res = run(args, split=False)
except Exception as e:
error(e)
return res.strip()