ByteArray Module
Provides several useful functions to deal with byte arrays (i.e., ByteArray).
Functions and values
| Function or value |
Description
|
Full Usage:
ByteArray.extractCString bytes offset
Parameters:
ByteArray
offset : int
Returns: string
|
Extracts a C-string (string that ends with a NULL char) from a byte array.
|
Full Usage:
ByteArray.extractCStringFromSpan span offset
Parameters:
ReadOnlySpan<byte>
offset : int
Returns: string
|
Extracts a C-string (string that ends with a NULL char) from a ReadOnlySpan.
|
Full Usage:
ByteArray.findIdxs offset pattern buf
Parameters:
uint64
pattern : byte array
buf : ByteArray
Returns: uint64 list
|
Finds and returns the absolute offsets of all positions in
|
Full Usage:
ByteArray.ofHexString s
Parameters:
string
Returns: byte array
|
Converts a hex string to a byte array. The input must not have a "0x" prefix and must contain an even number of hex characters. If the length is odd, the last character is silently ignored.
|
|
|
|
Converts a byte array to a hex string. Only the first 32 bytes are converted to avoid producing a very long string in case of a large byte array.
|
Full Usage:
ByteArray.tryFindIdx offset pattern buf
Parameters:
uint64
pattern : byte array
buf : ByteArray
Returns: uint64 option
|
Finds a matching byte position. If there is no match, this function will return None.
|
B2R2