From 5a20bb0a97200f3b71e0cbc31fc76023d491bd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20=C5=A0uca?= Date: Fri, 8 Nov 2024 10:05:40 +0100 Subject: [PATCH 1/2] UPDATE/CF-3206 - Added support for hash function - sync action --- python-sync-actions/src/user_functions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python-sync-actions/src/user_functions.py b/python-sync-actions/src/user_functions.py index 38c14ed..bf88690 100644 --- a/python-sync-actions/src/user_functions.py +++ b/python-sync-actions/src/user_functions.py @@ -88,6 +88,22 @@ def hash_hmac(self, algorithm, key, message): return stdout + def hash(self, algorithm, message): + """ + Execute PHP hash function + Args: + algorithm: + message: + + Returns: + + """ + + command = f"php -r 'echo hash(\"{algorithm}\", \"{message}\");'" + stdout, stderr = perform_shell_command(command, 'hash function') + + return stdout + def time(self): return int(time.time()) From 11e3e33beff06a0e7827d550994b9aefdeaa4c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20=C5=A0uca?= Date: Tue, 12 Nov 2024 13:32:11 +0000 Subject: [PATCH 2/2] intend --- python-sync-actions/src/user_functions.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python-sync-actions/src/user_functions.py b/python-sync-actions/src/user_functions.py index bf88690..57c5ada 100644 --- a/python-sync-actions/src/user_functions.py +++ b/python-sync-actions/src/user_functions.py @@ -90,19 +90,19 @@ def hash_hmac(self, algorithm, key, message): def hash(self, algorithm, message): """ - Execute PHP hash function - Args: - algorithm: - message: + Execute PHP hash function + Args: + algorithm: + message: - Returns: + Returns: - """ + """ - command = f"php -r 'echo hash(\"{algorithm}\", \"{message}\");'" - stdout, stderr = perform_shell_command(command, 'hash function') + command = f"php -r 'echo hash(\"{algorithm}\", \"{message}\");'" + stdout, stderr = perform_shell_command(command, 'hash function') - return stdout + return stdout def time(self): return int(time.time())