I want to create an encryption with java.
Is there anyway to get CPU Id or anything that be unique in PC such as BIOS or ...
for example System.getCpuId();
it is just an example 😉
Thanks a lot ...
Highlight the "My Computer" desktop icon and right mouse click, select "Properties", then select "Network Identification" and your cpuid is located there.
So you want a unique number (or string?) that identifies the user's computer? Or at least unique enough that the chance of a duplicate is very low, right?
You can get the Mac address of the network interface. This is making many assumptions, but it may be good enough for your needs:
final byte[] address = NetworkInterface.getNetworkInterfaces().nextElement().getHardwareAddress();
System.out.println("address = " + Arrays.toString(address));
This gives you an array of bytes. You can convert that to an id in several ways... like as a hex string.
Expect support though, when people replace bits of hardware in their computer.
I think such OS specific command is not available in Java.
This link shows a way to run it on windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With