Skip to content
Discussion options

You must be logged in to vote

I wrote some sample code to show one way to use magic search. To try it open a new file, resize it to 16 bytes and copy paste the values from the #pragma example into the input file. Copy paste the pattern and run it. It should place two structs called ToPlace in the sequence found and one at the end of the file.

#pragma example 34 35 44 66 56 65 5E 74 E7 66 75 78 56 66 00 00
import std.mem;

str sequence = "\xE7\x66\x75\x78";
struct ToPlace {
    u8 al;
};

std::mem::MagicSearch<sequence,ToPlace> search @0;

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@paxcut
Comment options

paxcut Jan 17, 2026
Collaborator

@maks7567
Comment options

@paxcut
Comment options

paxcut Jan 18, 2026
Collaborator

@paxcut
Comment options

paxcut Jan 18, 2026
Collaborator

Answer selected by maks7567
@maks7567
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants