Source

require'openssl'moduleChitinclassManifestdefself.register(hash)@@password_hash=hashend# retrieve the manifest entry for the namedefself.find(name)manifest_path=File.expand_path'.chitin_manifest'manifest=File.readmanifest_pathmanifest_hmac=manifest_data[0..511]manifest_data=manifest_data[512..-1]# verify the authenticity of the filecomputed_hmac=OpenSSL::HMAC.hexdigest('sha256',@@password_hash,manifest_data)unlesscomputed_hmac==manifest_hmacputs"MANIFEST FILE HAS BEEN TAMPERED WITH"return{}end@@data||={}@@data[manifest_path]||=YAML.loadmanifest_data@@data[manifest_path][name]enddefinitializeendendend