mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-27 20:08:54 +02:00
global-functions: add $GetRandomSha256
This commit is contained in:
parent
3589416840
commit
a1d05f93c6
1 changed files with 12 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
:global DownloadPackage;
|
:global DownloadPackage;
|
||||||
:global GetMacVendor;
|
:global GetMacVendor;
|
||||||
:global GetRandom;
|
:global GetRandom;
|
||||||
|
:global GetRandomSha256;
|
||||||
:global LogPrintExit;
|
:global LogPrintExit;
|
||||||
:global MailServerIsUp;
|
:global MailServerIsUp;
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
|
@ -316,6 +317,17 @@
|
||||||
:return ($Sum % $Max);
|
: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
|
# log and print with same text, optionally exit
|
||||||
:set LogPrintExit do={
|
:set LogPrintExit do={
|
||||||
:local Severity [ :tostr $1 ];
|
:local Severity [ :tostr $1 ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue