Software /
code /
prosody
Comparison
net/websocket/frames.lua @ 8728:41c959c5c84b
Fix spelling throughout the codebase [codespell]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Feb 2018 01:51:25 +0100 |
parent | 8442:3a390fa561bf |
child | 9659:86c431650dfd |
child | 11106:76f46c2579a2 |
comparison
equal
deleted
inserted
replaced
8727:285075a27f28 | 8728:41c959c5c84b |
---|---|
110 | 110 |
111 -- XORs the string `str` with the array of bytes `key` | 111 -- XORs the string `str` with the array of bytes `key` |
112 -- TODO: optimize | 112 -- TODO: optimize |
113 local function apply_mask(str, key, from, to) | 113 local function apply_mask(str, key, from, to) |
114 from = from or 1 | 114 from = from or 1 |
115 if from < 0 then from = #str + from + 1 end -- negative indicies | 115 if from < 0 then from = #str + from + 1 end -- negative indices |
116 to = to or #str | 116 to = to or #str |
117 if to < 0 then to = #str + to + 1 end -- negative indicies | 117 if to < 0 then to = #str + to + 1 end -- negative indices |
118 local key_len = #key | 118 local key_len = #key |
119 local counter = 0; | 119 local counter = 0; |
120 local data = {}; | 120 local data = {}; |
121 for i = from, to do | 121 for i = from, to do |
122 local key_index = counter%key_len + 1; | 122 local key_index = counter%key_len + 1; |