Skip to content

Commit

Permalink
binary/encode: don't encode lowercase strings as hex
Browse files Browse the repository at this point in the history
Should fix tulir#666
Closes tulir#738
  • Loading branch information
tulir authored and crazycodezombie committed Feb 8, 2025
1 parent 9cb0c84 commit 330f724
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions binary/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func validateHex(value string) bool {
return false
}
for _, char := range value {
if !(char >= '0' && char <= '9') && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f') {
if !(char >= '0' && char <= '9') && !(char >= 'A' && char <= 'F') {
return false
}
}
Expand All @@ -299,8 +299,6 @@ func packHex(value byte) byte {
return value - '0'
case value >= 'A' && value <= 'F':
return 10 + value - 'A'
case value >= 'a' && value <= 'f':
return 10 + value - 'a'
case value == 0:
return 15
default:
Expand Down

0 comments on commit 330f724

Please sign in to comment.