Class: SourceLicenseSDK::MachineIdentifier
- Inherits:
-
Object
- Object
- SourceLicenseSDK::MachineIdentifier
- Defined in:
- lib/source_license_sdk/machine_identifier.rb
Overview
Generates unique machine identifiers for license activation
Class Method Summary collapse
-
.generate ⇒ Object
Generate a unique machine identifier.
-
.generate_fingerprint ⇒ Object
Generate machine fingerprint (more detailed than machine ID).
Class Method Details
.generate ⇒ Object
Generate a unique machine identifier
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/source_license_sdk/machine_identifier.rb', line 10 def generate components = [] # Get hostname components << hostname # Get MAC addresses components.concat(mac_addresses) # Get CPU info if available components << cpu_info if cpu_info # Get motherboard info if available components << motherboard_info if motherboard_info # Get disk serial if available components << disk_serial if disk_serial # Create hash from all components raw_id = components.compact.join('|') Digest::SHA256.hexdigest(raw_id)[0..31] # First 32 characters end |
.generate_fingerprint ⇒ Object
Generate machine fingerprint (more detailed than machine ID)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/source_license_sdk/machine_identifier.rb', line 34 def generate_fingerprint components = [] # Basic system info components << hostname components << ruby_version components << platform # Network info components.concat(mac_addresses) components << local_ip # Hardware info components << cpu_info if cpu_info components << memory_info if memory_info components << disk_info if disk_info # Environment info components << environment_hash raw_fingerprint = components.compact.join('|') Digest::SHA256.hexdigest(raw_fingerprint) end |