remove debug statements, expand gemspec descrip
This commit is contained in:
parent
ca5d108478
commit
44eaeac32c
|
@ -9,8 +9,10 @@ Gem::Specification.new do |spec|
|
|||
spec.email = ['ceo@pixelridgesoftworks.com']
|
||||
|
||||
spec.summary = 'A custom hash mechanism for action tracking and validation.'
|
||||
spec.description = 'ActionHash provides a way to create and validate custom hashes for tracking user actions in a
|
||||
secure and efficient manner.'
|
||||
spec.description = 'ActionHash is a Ruby gem designed to validate a series of actions while obfuscating the associated
|
||||
data. Its particularly useful in scenarios where you want to ensure the integrity of a sequence of
|
||||
actions or data points, such as in gaming, financial transactions, IoT devices, and more. Please
|
||||
go to the homepage for more information about how to use this gem!'
|
||||
spec.homepage = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/ActionHash'
|
||||
spec.license = 'PixelRidge-BEGPULSE'
|
||||
spec.required_ruby_version = '>= 3.2.2'
|
||||
|
|
|
@ -23,11 +23,8 @@ module ActionHash
|
|||
end
|
||||
|
||||
data = [prev_hash, input_data].join(',')
|
||||
puts "Debug: Creating hash with prev_hash=#{prev_hash}, input_data=#{input_data}, key=#{key}"
|
||||
puts "Concatenated data before encryption: #{data}"
|
||||
encrypted_data = xor_encrypt(data, key)
|
||||
encrypted_hex = encrypted_data.unpack1('H*') # Convert to hex
|
||||
puts "Encrypted hex: #{encrypted_hex}"
|
||||
|
||||
# Increment the usage count for the key
|
||||
@key_usage_count[key] += 1
|
||||
|
@ -37,10 +34,8 @@ module ActionHash
|
|||
|
||||
# Decrypt an Action Hash to its components
|
||||
def self.down_layer(hash, key)
|
||||
puts "Debug: Decrypting hash=#{hash} with key=#{key}"
|
||||
hex_decoded = [hash].pack('H*') # Convert from hex
|
||||
decrypted_data = xor_encrypt(hex_decoded, key)
|
||||
puts "Decrypted data: #{decrypted_data}"
|
||||
prev_hash, input_data = decrypted_data.split(',')
|
||||
{ prev_hash: prev_hash.to_s, input_data: input_data.to_s }
|
||||
end
|
||||
|
@ -54,7 +49,6 @@ module ActionHash
|
|||
def self.valid_hash?(hash, key, level = 20)
|
||||
current_level = 0
|
||||
loop do
|
||||
puts "Debug: Validating hash=#{hash} with key=#{key} at level=#{current_level}"
|
||||
return false if current_level >= level
|
||||
|
||||
decrypted_data = down_layer(hash, key)
|
||||
|
|
Loading…
Reference in New Issue
Block a user