MCPcopy
hub / github.com/ThatGuySam/doesitarm / FindMagic

Function FindMagic

helpers/macho/macho.js:94–106  ·  view source on GitHub ↗
(data, breakwhenfound = false)

Source from the content-addressed store, hash-verified

92 @Return (Array) offsets of found magics
93 */
94 function FindMagic(data, breakwhenfound = false) {
95 var results = [];
96 for(var byte = 0; byte < (data.length - uint32_t); byte++) { //Read 32-bits at a time until the end of the buffer
97 var magic = ReadUint32(data, byte); //Read the next 32-bit magic value
98 if(MAGIC.VALIDATE(magic)) {
99 results.push(byte);
100 if(breakwhenfound) {
101 break;
102 }
103 }
104 }
105 return results;
106 }
107
108
109 /*

Callers 1

onloadendFunction · 0.85

Calls 1

ReadUint32Function · 0.90

Tested by

no test coverage detected