MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / scHttpWebSocketBase64Value

Function scHttpWebSocketBase64Value

Libraries/Http/HttpWebSocket.cpp:145–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 return SC::Result(true);
144}
145
146static int scHttpWebSocketBase64Value(char value)
147{
148 if (value >= 'A' and value <= 'Z')
149 {
150 return value - 'A';
151 }
152 if (value >= 'a' and value <= 'z')
153 {
154 return 26 + value - 'a';
155 }
156 if (value >= '0' and value <= '9')
157 {
158 return 52 + value - '0';
159 }
160 if (value == '+')
161 {
162 return 62;
163 }
164 if (value == '/')
165 {
166 return 63;
167 }
168 return -1;
169}
170
171static SC::Result scHttpWebSocketBase64Decode(SC::StringSpan value, SC::Span<uint8_t> output, size_t& decodedBytes)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected