Skip to content

Commit

Permalink
strings.Contains replaced with bytes.Contains
Browse files Browse the repository at this point in the history
  • Loading branch information
EgeBalci committed Oct 4, 2020
1 parent 3b6ed0f commit 6ec2194
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"bytes"
"encoding/base64"
"encoding/hex"
"errors"
Expand Down Expand Up @@ -188,10 +189,10 @@ func encode(encoder *sgn.Encoder, payload []byte) ([]byte, error) {
return final, nil
}

// checks if a bytes array contains any element of another byte array
func containsBytes(data, bytes []byte) bool {
for _, b := range bytes {
if strings.Contains(string(data), string(b)) {
// checks if a byte array contains any element of another byte array
func containsBytes(data, any []byte) bool {
for _, b := range any {
if bytes.Contains(data, []byte{b}) {
return true
}
}
Expand Down

0 comments on commit 6ec2194

Please sign in to comment.