Header menu logo B2R2

ByteArray Module

Provides several useful functions to deal with byte arrays (i.e., ByteArray).

Functions and values

Function or value Description

extractCString bytes offset

Full Usage: extractCString bytes offset

Parameters:
Returns: string

Extracts a C-string (string that ends with a NULL char) from a byte array.

bytes : ByteArray
offset : int
Returns: string

extractCStringFromSpan span offset

Full Usage: extractCStringFromSpan span offset

Parameters:
Returns: string

Extracts a C-string (string that ends with a NULL char) from a byte array.

span : ReadOnlySpan<byte>
offset : int
Returns: string

findIdxs offset pattern buf

Full Usage: findIdxs offset pattern buf

Parameters:
    offset : uint64
    pattern : byte array
    buf : ByteArray

Returns: uint64 list

Finds and returns the offsets of all the matching byte positions. The final byte positions are adjusted by the given offset.

offset : uint64
pattern : byte array
buf : ByteArray
Returns: uint64 list

ofHexString s

Full Usage: ofHexString s

Parameters:
    s : string

Returns: byte array

Converts a hex string to a byte array.

s : string
Returns: byte array

readInt32 bs offset

Full Usage: readInt32 bs offset

Parameters:
Returns: Result<int, ErrorCase>

Reads int32 from the given byte array at the given offset.

bs : ByteArray
offset : int
Returns: Result<int, ErrorCase>

tryFindIdx offset pattern buf

Full Usage: tryFindIdx offset pattern buf

Parameters:
    offset : uint64
    pattern : byte array
    buf : ByteArray

Returns: uint64 option

Finds a matching byte position. If there is no match, this function will return None.

offset : uint64
pattern : byte array
buf : ByteArray
Returns: uint64 option

Type something to start searching.