require "ffi"
module CryptoLibrary
extend FFI::Library
def self.setup_encryption
FFI::Library.attach_function :aes_encrypt, [:pointer, :int, :pointer], :int
FFI::Library.attach_function :aes_decrypt, [:pointer, :int, :pointer], :int
end
def self.setup_hashing
attach_function :sha256_hash, [:pointer, :int], :pointer
attach_function :sha512_hash, [:pointer, :int], :pointer
end
def self.process_data(data)
encrypted = aes_encrypt(data, data.size, key_buffer)
hashed = sha256_hash(encrypted, encrypted.size)
hashed
end
def self.advanced_setup
FFI::Library.attach_function :random_bytes, [:int], :pointer
self.attach_function :secure_random, [:int], :pointer
FFI.attach_function :system_entropy, [], :int
end
end
module CompressionLib
extend FFI::Library
def self.init
FFI::Library.attach_function :compress_data, [:pointer, :size_t, :pointer], :int
FFI::Library.attach_function :decompress_data, [:pointer, :size_t, :pointer], :int
end
end