Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Tool:Ghidra Function ID

From ReverseEngineering.wiki
Tool
Vendor NSA (Ghidra project)
License Apache-2.0
Website https://github.com/NationalSecurityAgency/ghidra
On this wiki Facts · Code · Notes · Topics

Ghidra's Function ID feature names library functions by hashing their instructions and looking the hash up in .fidb database files shipped with Ghidra (Visual Studio runtimes) or built by the user.

What it stores

A .fidb is a Ghidra database (packed form; the unpacked working form uses extension .fidbf) with these tables, defined in FunctionID/src/main/java/ghidra/feature/fid/db/: Libraries (family name, version, variant, Ghidra version, language id, compiler specs), Strings (names and domain paths, deduplicated), Functions, and Relations (superior/inferior, that is caller/callee, pairs of function ids). See Fact:Ghidra Function ID/struct/Functions table record.

How the hash is made

For each function, the instruction stream is hashed with FNV-1a 64-bit. Operands are masked: the full hash ignores every scalar (it only records that one was present) and addresses; the specific hash additionally mixes in small scalar constants (absolute value below 256) and whole-operand scalars that are not addresses. Registers go into both hashes. Instructions with relocations have scalar values replaced by a placeholder. A function shorter than the minimum instruction count (code units) is not hashed at all, so tiny functions never match unless flagged auto-pass.

Matching

A full-hash hit is accepted when its score passes a threshold (14.6 in FidService, 30 when several names share the hash), using the number of code units, the specific hash and parent/child relations as extra evidence. Records have flags: has-terminator, auto-pass, auto-fail, force-specific (specific hash must also match) and force-relation (a caller or callee must also match).

Using it

  • Analysis option: Function ID (Windows analyzers also run it). Attach more files with Tools > Function ID > Attach existing FidDb, or the script AttachFidDatabase.java.
  • Ghidra ships .fidb files for Visual Studio 1998 to 2015, debug and release, 32 and 64 bit, built with a common-symbols list (common_symbols_win32.txt, common_symbols_win64.txt) so very common names are not trusted as unique. data/building_fid.txt documents the build and the post-processing with RemoveFunctions.java and RepackFid.java.
  • Build your own: Tools > Function ID > Populate FidDb from programs, or headless with FunctionIDHeadlessPrescript.java / Postscript and ImportMSLibs.java for Microsoft .lib files; scripts such as FindFunctionByHash.java, FIDHashCurrentFunction.java and FidStatistics.java help debugging.

See Technique:Library function recognition and Tool:Ghidra BSim.

Code & repositories

  • https://github.com/NationalSecurityAgency/ghidra @ 9a723ce99952771b8368329503aa589ae233e916 · license: Apache-2.0
    Ghidra source: Features/FunctionID (fidb schema, hasher, scripts, building_fid.txt) and Features/BSim (config templates, scripts).
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries