File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 11package websocket
22
3- // Mask applies the WebSocket masking algorithm to p
3+ // mask applies the WebSocket masking algorithm to p
44// with the given key where the first 3 bits of pos
55// are the starting position in the key.
66// See https://tools.ietf.org/html/rfc6455#section-5.3
77//
8- // It is highly optimized to mask per word with the usage
9- // of unsafe.
10- //
11- // For targets that do not support unsafe, please report an issue.
12- // There is a mask by byte function below that will be used for such targets.
8+ // The returned value is the position of the next byte
9+ // to be used for masking in the key.
1310func mask (key [4 ]byte , pos int , p []byte ) int {
14- panic ("TODO" )
11+ for i := range p {
12+ p [i ] ^= key [pos & 3 ]
13+ pos ++
14+ }
15+ return pos & 3
1516}
You can’t perform that action at this time.
0 commit comments