SplitScript reference / Module / md5

Module.md5

Method

Module.md5() -> async String!

Computes the MD5 fingerprint of the module's complete on-disk file.

The result is the canonical 32-character uppercase hexadecimal form. This is intentionally based on file bytes rather than the mapped image, Module.size, or version metadata, so builds with otherwise identical metadata can still be selected exactly. Hashing is cooperative: only a bounded file window is read per host update. If the file changes while it is being read, hashing restarts and only completes after observing one stable version. Filesystem and metadata failures are returned as an error.

Effects: allocates, reads the filesystem, reads process memory, requires an attached process, suspends, cancels when the process closes

Runtime behavior: available in suspending attachment code; suspends; cancels when the process closes

Examples

Select a known executable build

let executable = await process.mainModule()
let fingerprint = (await executable.md5())?
if fingerprint == "951389C953020FC7B5DEF32E7BED129A" {
    print("recognized build")
}