aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions12
1 files changed, 12 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index 4bc0d0b..a37ce5d 100644
--- a/global-functions
+++ b/global-functions
@@ -28,6 +28,7 @@
:global DownloadPackage;
:global GetMacVendor;
:global GetRandom;
+:global GetRandomSha256;
:global LogPrintExit;
:global MailServerIsUp;
:global MkDir;
@@ -316,6 +317,17 @@
:return ($Sum % $Max);
}
+# generate random sha256 string
+# returns 64 bytes of 0-9 and a-f
+:set GetRandomSha256 do={
+ :local FingerPrint;
+ / certificate add name=GetRandomSha256-template common-name=GetRandomSha256 key-size=prime256v1;
+ / certificate sign GetRandomSha256-template name=GetRandomSha256 without-paging as-value;
+ :set FingerPrint [ / certificate get GetRandomSha256 fingerprint ];
+ / certificate remove GetRandomSha256;
+ :return $FingerPrint;
+}
+
# log and print with same text, optionally exit
:set LogPrintExit do={
:local Severity [ :tostr $1 ];