go-hexadeca/bytes/encodebyte.go

23 lines
666 B
Go
Raw Normal View History

2023-10-27 20:18:32 +00:00
package hexadecabytes
import (
2024-07-25 11:33:45 +00:00
"github.com/reiver/go-hexadeca/symbols/byte"
2023-10-27 20:18:32 +00:00
)
// EncodeByte encodes the value of a byte into hexadecimal.
func EncodeByte(value byte, symbolFunc func(byte)byte) (mostSignificant byte, leastSignificant byte) {
2023-10-28 20:22:38 +00:00
mostSignificant = symbolFunc( (0x0f & (value >> 4)) )
leastSignificant = symbolFunc( (0x0f & (value )) )
2023-10-27 20:18:32 +00:00
return
}
func EncodeByteUsingLowerCaseSymbols(value byte) (mostSignificant byte, leastSignificant byte) {
return EncodeByte(value, bytesymbols.LowerCase)
}
func EncodeByteUsingUpperCaseSymbols(value byte) (mostSignificant byte, leastSignificant byte) {
return EncodeByte(value, bytesymbols.UpperCase)
}