aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-03-04 16:55:32 +0100
committerKim Alvefur <zash@zash.se>2022-03-04 16:55:32 +0100
commit1f257ecbb43ef08ae142f2b628819d327d066ee0 (patch)
tree80290dbb8d964ba99bd02a92078210dcae37fbcd
parent27943c671cab85e37cac86e96f9bd0a064c1c689 (diff)
downloadprosody-1f257ecbb43ef08ae142f2b628819d327d066ee0.tar.gz
prosody-1f257ecbb43ef08ae142f2b628819d327d066ee0.zip
net.stun: Use util.strbitop
Improves performance since the whole procedure is done in C
-rw-r--r--net/stun.lua12
1 files changed, 1 insertions, 11 deletions
diff --git a/net/stun.lua b/net/stun.lua
index aefc4b27..688becc3 100644
--- a/net/stun.lua
+++ b/net/stun.lua
@@ -3,17 +3,7 @@ local hashes = require "util.hashes";
local net = require "util.net";
local random = require "util.random";
local struct = require "util.struct";
-
---- Private helpers
-
--- XORs a string with another string
-local function sxor(x, y)
- local r = {};
- for i = 1, #x do
- r[i] = string.char(bit32.bxor(x:byte(i), y:byte(i)));
- end
- return table.concat(r);
-end
+local sxor = require"util.strbitop".sxor;
--- Public helpers