Add WASM parser and Vue dissector UI.
Ship a working HexPigeon: typed binary parsing in Rust/WASM, a three-pane frontend, and unit tests covering the field types. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/** Parse a hex dump string into byte values. Whitespace is ignored. */
|
||||
export function parseHexInput(hex: string): number[] {
|
||||
const clean = hex.replace(/\s/g, '')
|
||||
if (clean.length % 2 !== 0) return []
|
||||
const out: number[] = []
|
||||
for (let i = 0; i < clean.length; i += 2) {
|
||||
const b = parseInt(clean.slice(i, i + 2), 16)
|
||||
if (Number.isNaN(b)) return []
|
||||
out.push(b)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** Format bytes as uppercase hex pairs separated by spaces. */
|
||||
export function formatHexBytes(bytes: number[]): string {
|
||||
return bytes.map(b => b.toString(16).padStart(2, '0').toUpperCase()).join(' ')
|
||||
}
|
||||
Reference in New Issue
Block a user