Feature/cherrypick ws (#52)

* int to hex

* Websocket frame size

* Hash methods refactor

* Uri components fix
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-02-27 20:10:21 -05:00
1 parent 0e2be8d5bb
commit 0d79c4975e
4 files changed
+56 -14

No files matched your search

@@ -16,4 +16,15 @@ namespace ColorUtils
return value
end function
function IntToHex(color as integer) as string
hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
hexString = "#"
for i = 7 to 0 step -1
hexString = hexString + hexDigits[(color >> (i * 4)) and &hF]
end for
return hexString
end function
end namespace
+10 -7
View File
@@ -1,17 +1,20 @@
function GetSha256(input as string) as string
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(input)
digest = CreateObject("roEVPDigest")
digest.Setup("sha256")
return digest.Process(buffer)
return GetEvpDigest(input, "sha256")
end function
function GetSha1(input as string) as string
return GetEvpDigest(input, "sha1")
end function
function GetMd5(input as string) as string
return GetEvpDigest(input, "md5")
end function
function GetEvpDigest(input as string, method as string) as string
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(input)
digest = CreateObject("roEVPDigest")
digest.Setup("sha1")
digest.Setup(method)
return digest.Process(buffer)
end function
+5 -3
View File
@@ -13,7 +13,7 @@ namespace WebUtils
if Instr(0, component, "=")
keyValue = component.split("=")
key = keyValue[0]
value = keyValue[1]
value = keyValue[1].DecodeUriComponent()
hasValue = true
end if
@@ -22,11 +22,13 @@ namespace WebUtils
if GetInterface(oldValue, "ifArray") = invalid
oldValue = [oldValue]
end if
oldValue.push(value)
oldValue.push(value.DecodeUriComponent())
value = oldValue
end if
query[key] = value
if key <> ""
query[key] = value
end if
end for
return query
end function