#build #uuid #differs #compile-time #build-id

sys build_uuid

Obtain a UUID uniquely representing the build of the current binary

1 unstable release

0.3.0 Oct 24, 2022

#1998 in Development tools

Download history 117/week @ 2023-12-15 40/week @ 2023-12-22 122/week @ 2023-12-29 150/week @ 2024-01-05 60/week @ 2024-01-12 51/week @ 2024-01-19 65/week @ 2024-01-26 55/week @ 2024-02-02 95/week @ 2024-02-09 89/week @ 2024-02-16 89/week @ 2024-02-23 55/week @ 2024-03-01 60/week @ 2024-03-08 61/week @ 2024-03-15 78/week @ 2024-03-22 60/week @ 2024-03-29

267 downloads per month
Used in laze

MIT/Apache

11KB
110 lines

build_uuid

Crates.io MIT / Apache 2.0 licensed

Docs

THIS IS A FORK OF https://github.com/alecmocatta/build_id!

Obtain a Uuid uniquely representing the build of the current binary.

This is intended to be used to check that different processes are indeed invocations of identically laid out binaries.

As such:

  • It is guaranteed to be identical within multiple invocations of the same binary.
  • It is guaranteed to be different across binaries with different code or data segments or layout.
  • Equality is unspecified if the binaries have identical code and data segments and layout but differ immaterially (e.g. if a timestamp is included in the binary at compile time).

Examples

let local_build_uuid = build_uuid::get();
if local_build_uuid == remote_build_uuid {
	println!("We're running the same binary as remote!");
} else {
	println!("We're running a different binary to remote");
}

Note

This looks first for linker-inserted build ID / binary UUIDs (i.e. .note.gnu.build-id on Linux; LC_UUID in Mach-O; etc), falling back to hashing the whole binary.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~525KB