Skip to content
Karsten Hahn edited this page Mar 17, 2021 · 3 revisions

The import hash will be available in release 3.0.0 of PortEx. It provides the same hashes as the pefile implementation which seems to be the commonly used algorithm, e.g., on Virustotal.

import package com.github.katjahahn.tools;

File file = new File("WinRar.exe");
// Get hash as byte array
byte[] imphashArray = ImpHash.calculate(file);
// Get hash as hex string
String imphashStr = ImpHash.createString(file);
System.out.println(imphashStr);
Clone this wiki locally