Format:Hermes bytecode (HBC)
| Magic | C6 1F BC 03 C1 03 19 1F (uint64 0x1F1903C103BC1FC6, little-endian) |
|---|---|
| Extensions | .hbc, index.android.bundle, main.jsbundle |
| Endianness | little |
| License | MIT (facebook/hermes) |
| Website | https://github.com/facebook/hermes |
| On this wiki | Facts · Code · Notes · Topics |
Bytecode container of the Hermes JavaScript engine used by React Native: a file starting with the 8-byte magic C6 1F BC 03 C1 03 19 1F and a 32-bit bytecode version, usually shipped as assets/index.android.bundle in an APK.
Identification
A React Native app built with the Hermes engine does not ship JavaScript text: its bundle (Android: assets/index.android.bundle, iOS: main.jsbundle) is Hermes bytecode (HBC). Check the first 8 bytes. A plain JS bundle starts with readable text; a Hermes one starts with C6 1F BC 03 C1 03 19 1F, followed by a 32-bit version. A disassembler for ARM/x86 shows nothing useful: the logic is in the bytecode, the native code is only the Hermes VM (libhermes.so in React Native APKs; newer React Native versions may link it into another library, unverified).
Header
BytecodeFileHeader (packed, little-endian, include/hermes/BCGen/HBC/BytecodeFileFormat.h): magic (u64), version (u32), sourceHash (20 bytes SHA-1), fileLength (u32), globalCodeIndex, functionCount, stringKindCount, identifierCount, stringCount, overflowStringCount, stringStorageSize, bigIntCount, bigIntStorageSize, regExpCount, regExpStorageSize, literalValueBufferSize, objKeyBufferSize, objShapeTableCount, numStringSwitchImms, segmentID, cjsModuleCount, functionSourceCount, debugInfoOffset (all u32), BytecodeOptions (1 byte bitfield: StaticBuiltins, CjsModulesStaticallyResolved), 15 bytes padding. A footer holds a SHA-1 of everything above it. The header is followed by the function header table, then the string tables and the other blobs.
A delta (incremental) bytecode file uses the complemented magic (DELTA_MAGIC = ~MAGIC).
Exact layout (BytecodeFileFormat.h at 17b37301da5d)
The header is packed and 128 bytes: magic 8, version 4, sourceHash 20, then 20 u32 fields from fileLength to debugInfoOffset (80 bytes), BytecodeOptions 1 byte (bit 0 StaticBuiltins, bit 1 CjsModulesStaticallyResolved), padding 15 bytes (a static_assert requires the size to be a multiple of 32). fileLength counts up to the end of the footer; the footer is a 20-byte SHA-1 of everything above it.
Segments follow in the order of visitBytecodeSegmentsInOrder: function headers, string kinds (run-length entries), identifier hashes (u32 each), small string table, overflow string table, string storage, literal value buffer, object key buffer, object shape table, bigint table, bigint storage, regexp table, regexp storage, CJS module table, function source table. Unverified: that the per-function data (bytecode, exception handler tables, jump tables) follows those tables and the debug info starts at debugInfoOffset; check with a dumper.
Small string table entry: one u32, bit 0 IsUTF16, bits 1-23 Offset (23 bits), bits 24-31 Length (8 bits); INVALID_LENGTH is 255 and INVALID_OFFSET is 1<<23, used for entries that overflow into the overflow table of {u32 offset, u32 length}.
SmallFuncHeader is 12 bytes: word 1 = Offset (25 bits, the bytecode offset), ParamCount (5), LoopDepth (2); word 2 = BytecodeSizeInBytes (14), FunctionName (8, a string id), NumberRegCount (5), NonPtrRegCount (5); then FrameSize (8), ReadCacheSize (8), WriteCacheSize (7), PrivateNameCacheSize (1), and a flags byte (ProhibitInvoke 2 bits, StrictMode, HasExceptionHandler, HasDebugInfo, Overflowed, Kind 2 bits). If Overflowed is set, the small header only holds the offset of a full FunctionHeader (low 24 bits in Offset, high 8 bits in FunctionName). Field widths are for the pinned commit; older bytecode versions used other widths: Unverified.
Version
The version is one integer, bumped whenever the format or the instruction set changes; a VM refuses a bundle with another version. The facebook/hermes main branch at the pinned commit has BYTECODE_VERSION = 99 (file include/hermes/BCGen/HBC/BytecodeVersion.h, updated 2026-02-12). Older React Native releases bundle Hermes with lower versions. Read from BytecodeVersion.h at the Hermes release tags named after React Native releases (tag names hermes-<date>-RNv<version>-<commit>): RN 0.69 = 85 (tags of 2022-04-28 and 2022-05-20); RN 0.70 = 89; RN 0.71 = 90 (also the 0.71.19 tag of 2024-04-26); RN 0.72 = 94 (0.72.4, 0.72.14 and 0.72.17 tags); RN 0.73 to 0.82 = 96 (every RN 0.73 to 0.82 tag read gives 96). Standalone Hermes tags: v0.9.0 to v0.11.0 = 84, v0.12.0 = 89, v0.13.0 to hermes-v0.17.0 = 96, hermes-v250829098.0.2 = 98, hermes-v260318099.0.4 = 99. Only the tags listed were read, so a number between two read tags may exist. Unverified: which Hermes tag a given RN release finally shipped (check that RN release's hermes-engine configuration).
Practical consequence: tools that decode HBC need the instruction table of the right version. Third-party decompilers and disassemblers (hermes-dec, hbctool style projects) support a range of versions; Unverified: which versions each third-party decompiler currently supports (read its README). The Hermes repo itself builds hbcdump/hermes -dump-bytecode that print the disassembly for the versions it supports.
What to look for
- Strings and identifiers sit in the string table in clear text (function names, property names, URLs):
stringson the bundle already reveals much. - Debug info (
debugInfoOffset) carries source locations if the bundle was not stripped; source maps are usually not shipped. - With
sourceHashequal across builds you can tell whether the JS source changed.
See Technique:Cross-platform app frameworks and Platform:Android.
Decompilers
See Technique:Choosing a decompiler and Tool:Hermes-dec (disassembler and pseudo-code decompiler).
Code & repositories
- https://github.com/facebook/hermes @
17b37301da5da4a2cd55d78f9697c46c0fd96123· license: MIT
Hermes engine source: bytecode header, version constant, dumper tools.
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-15 - https://github.com/P1sec/hermes-dec @
2e796663e1fedb93dca51060797ebf3327b3fedb· license: unrecognized (LICENSE)
hermes-dec HBC disassembler and decompiler
Tested on: source read, not run: not run; README read · checked 2026-10-18; the license file was not recognized automatically: read it
Open questions
- Mapping of releases to versions: see the Version section (read from release tags).
- Unverified: whether Static Hermes bundles (typed mode) use another container.