Skip to main content

Python library to generate a unique device fingerprint based on physical characteristics

Project description


Device Fingerprint

device_fingerprint is a Python library designed to generate a unique digital fingerprint based on the physical characteristics of an electronic device. It captures details like the device's battery status, exact system time (with millisecond precision), and MAC address. This library also provides secure handling of data by hashing with SHA-256 and encrypting using AES encryption.

Features

  • Generate Device Fingerprint: Create a unique fingerprint based on device characteristics.
  • Encrypt and Decrypt Data: Securely encrypt and decrypt data using AES encryption.
  • Retrieve Device Information: Get current battery status, system time, and MAC address.

Installation

To install the device_fingerprint library, use pip:

pip install device-fingerprint

Usage

Generating a Fingerprint

Here's how to use the device_fingerprint library to generate a unique fingerprint:

from device_fingerprint import DeviceFingerprint

# Define a 16-byte key for AES encryption
# AES key must be either 16, 24, or 32 bytes long
key = b'ThisIs16BytesKey!'

# Initialize the DeviceFingerprint class with your encryption key
fingerprint_generator = DeviceFingerprint(encryption_key=key)

# Generate a unique fingerprint for the device
fingerprint = fingerprint_generator.generate_fingerprint()
print(f"Fingerprint: {fingerprint}")

# Retrieve the device's MAC address
mac_address = fingerprint_generator.get_mac_address()
print(f"MAC Address: {mac_address}")

# Encrypt and decrypt data
encrypted_mac = fingerprint_generator.encrypt_data(mac_address)
print(f"Encrypted MAC Address: {encrypted_mac}")

decrypted_mac = fingerprint_generator.decrypt_data(encrypted_mac)
print(f"Decrypted MAC Address: {decrypted_mac}")

API Reference

DeviceFingerprint

  • Constructor: DeviceFingerprint(encryption_key: bytes)

    • Initializes the DeviceFingerprint class with the specified AES encryption key.
    • encryption_key: A byte string for AES encryption. Must be 16, 24, or 32 bytes long.
  • Method: generate_fingerprint()

    • Generates a unique fingerprint based on device characteristics.
    • Returns: A string representing the unique device fingerprint.
  • Method: get_mac_address()

    • Retrieves the MAC address of the device.
    • Returns: A string representing the MAC address.
  • Method: encrypt_data(data: str)

    • Encrypts the given data using AES encryption.
    • data: A string of data to encrypt.
    • Returns: A string representing the encrypted data.
  • Method: decrypt_data(encrypted_data: str)

    • Decrypts the given encrypted data using AES decryption.
    • encrypted_data: A string of encrypted data.
    • Returns: A string representing the decrypted data.

Security

  • Ensure that your AES encryption key is kept secure and private.
  • The library uses SHA-256 for hashing and AES for encryption to provide secure data handling.

Feel free to adjust the repository links and license details as needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Device_Fingerprint-1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file Device_Fingerprint-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Device_Fingerprint-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf09d21323fefcfb2ae91ca4e07a8077e2bdd4def2ae3aba2be6f1a3dde39488
MD5 d3637bc834e3c8f398ca7d1bf2582eea
BLAKE2b-256 1d032a52a4e2298799ffa6a5c2cd21de2495c5d6a5ab7056d9eae3d4df36db5f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page