2023-10-27 20:18:32 +00:00
|
|
|
package hexadecabytes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sourcecode.social/reiver/go-hexadeca/symbols/byte"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|