<div dir="ltr">Hi all,<br><br>Not sure if this is best for core-libs or langtools, but best I can tell there is no way to determine the hash of a module programmatically.<br><br>Hashes of dependent modules are recorded in JMOD files<br><br><font face="monospace">jmod describe jdks/aarch64_windows/jmods/java.base.jmod</font><br><br><font face="monospace">java.base@23.0.1</font><br><font face="monospace">....</font><br><font face="monospace">platform linux-ppc64le</font><br><font face="monospace">hashes java.datatransfer SHA-256 e9cac9cb3758d80a42e814cc0a03e5f34b511491b5f5542da1ccff6fbc4c8ac8</font><br><font face="monospace">hashes java.desktop SHA-256 342b94944765b78932de60aaf9e47811f23d60461c7014557e84ca1d6f6c135d</font><br><font face="monospace">hashes java.instrument SHA-256 e238b7968a4a2cf233781def3a5c18e5ba828a077de47adb0524ac07d16289d4</font><br><font face="monospace">hashes java.logging SHA-256 0702fb1772a4afc72ed95c834075ee608eff8ba8c501efc6520b457ac9ae2560</font><br><font face="monospace">hashes java.management SHA-256 e61678895158866416322cb814b2425334374879cfb42d2201f8959a20a6568a</font><br><font face="monospace">...</font><br><br><font face="arial, sans-serif">But simply SHA-256ing the JMODs of these modules will not yield these hashes.<br><br>Best I can gather, this functionality is only in a private API. <br><br></font><a href="https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/module/ModuleHashes.java#L111">https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/module/ModuleHashes.java#L111</a><font face="arial, sans-serif"><br><br>If I try to replicate it with my own ModuleReferences I quickly run into "jmods cannot be used at run time" errors.<br></font><br><div><a href="https://github.com/openjdk/jdk/blob/a6277bb521e07e569cd75a4641b2a05a26f47b0a/src/java.base/share/classes/jdk/internal/module/ModulePath.java#L137-L141">https://github.com/openjdk/jdk/blob/a6277bb521e07e569cd75a4641b2a05a26f47b0a/src/java.base/share/classes/jdk/internal/module/ModulePath.java#L137-L141</a><br><br>Is there an API I am missing or at least documentation of how exactly these hashes are computed in a way I can replicate?</div></div>