#unique-identifier #identifier

uniqueid

Generates a unique hash/identifier for a system given a set of parameters

5 releases

0.2.6 May 18, 2022
0.2.2 May 18, 2022
0.2.1 May 18, 2022
0.2.0 May 16, 2022
0.1.0 May 9, 2022

#1255 in Cryptography

GPL-3.0 license

19KB
231 lines

uniqueid 🔍

Generates a unique hash/identifier for a system given a set of parameters.

Example usage

   use uniqueid::{IdentifierBuilder, IdentifierType};

   let mut builder = IdentifierBuilder::default();
   
   builder.name("test");
   builder.add(IdentifierType::CPU);
   builder.add(IdentifierType::RAM);
   builder.add(IdentifierType::DISK);

   let identifier = builder.build();

   println!("{}", identifier.to_string(false)); // false = do not hash the identifier (useful for debugging)

Specification

UniqueID uses its own specification.

The spec consists of three parts:
    - The Identifier; []
    - The IdentifierType; ()
    - The IdentifierTypeData; (a=b, ...)
      
A basic identifier would look like this: 

NAME[TYPE(a=b, ...), ...]

NAME - Optional name of the identifier. (Can be used as a label or salt)
TYPE - The type of identifier, e.g. CPU, GPU, etc.
DATA - The data for the identifier, e.g. Vendor=Intel, Model=Xeon E5-2670

This is a very basic example of an identifier, and most use cases will have more types, more data, and hash the output.

Roadmap

  • Calculate the HWID based on the system's hardware in the library without needing to specify it manually.
  • Add support for other identifier types. (currently only supports CPU, RAM, and DISK) - PR's welcome!
  • Add disk serial checking.
  • Add support for other hashing algorithms. (currently only supports SHA3-512)

License

This software is licensed under the GNU General Public License v3.0

For more information, see the LICENSE file in the root directory of this project or see here.

Dependencies

~2.5MB
~30K SLoC