From ecba456ef605dc7de765b36bf9d8899c7e38aebb Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Thu, 7 Sep 2017 12:58:42 +1000 Subject: [PATCH] made sha256.lua behave on plain lua --- modules/lib/sha256.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/lib/sha256.lua b/modules/lib/sha256.lua index a794a28..0d776da 100644 --- a/modules/lib/sha256.lua +++ b/modules/lib/sha256.lua @@ -6,8 +6,9 @@ -- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua -- -- Data card support added by https://github.com/SuPeRMiNoR2 -sha = {} -if component.data then +_G.sha = {} +if component then + if component.data then datac = component.data function sha.sha256(data) local d=component.data.sha256(data) @@ -15,6 +16,7 @@ if component.data then return string.format("%02x", string.byte(c)) end)) end + end else local MOD = 2^32 local MODM = MOD-1