Diff

util/sha1.lua @ 486:6416ea3fff86

Fix sha1 support when no binary dependencies available
author Matthew Wild <mwild1@gmail.com>
date Thu, 23 Mar 2023 19:06:04 +0000
parent 111:75c73ac9d5a6
child 490:6b2f31da9610
line wrap: on
line diff
--- a/util/sha1.lua	Thu Mar 23 18:56:32 2023 +0000
+++ b/util/sha1.lua	Thu Mar 23 19:06:04 2023 +0000
@@ -13,7 +13,7 @@
 local strbyte = string.byte
 local strsub  = string.sub
 local floor   = math.floor
-local bit     = require "bit"
+local bit     = bit32 or require "util.bit"
 local bnot    = bit.bnot
 local band    = bit.band
 local bor     = bit.bor
@@ -138,8 +138,9 @@
 	end
 end
 
-_G.sha1 = {sha1 = sha1};
-return _G.sha1;
+return {
+	sha1 = sha1;
+};
 
 -------------------------------------------------
 -------------------------------------------------