add toBytes (#14)
This commit is contained in:
parent
1c4293b3e7
commit
cf4df3dc50
|
@ -123,3 +123,9 @@ func toHex*[N: static[int]](ba: array[N, byte]): string {.inline.} =
|
|||
## Output is in lowercase
|
||||
## No "endianness" reordering is done.
|
||||
toHexAux(ba)
|
||||
|
||||
func toBytes*(s: string): seq[byte] =
|
||||
## Convert a string to the corresponding byte sequence - since strings in
|
||||
## nim essentially are byte sequences without any particular encoding, this
|
||||
## is almost a noop
|
||||
cast[seq[byte]](s)
|
||||
|
|
Loading…
Reference in New Issue