简体   繁体   English

将文件签名与预定义签名进行比较的最佳方法是什么?

[英]What is the Best way to compare file signature to predefined signatures?

I've a list of XML Files (700 files) that contain a File Signature record. 我有一个包含文件签名记录的XML文件列表(700个文件)。 I would like to test a given file against those list of signature records. 我想针对那些签名记录列表测试给定文件。 What is the best way to store those XML Files to do fast comparison ? 存储这些XML文件以进行快速比较的最佳方法是什么?

2nd Problem: How do I detect a bad signature? 第二个问题:如何检测到错误的签名?

Preprocess those files and create a dictionary mapping file signatures to filenames. 预处理这些文件并创建字典映射文件签名到文件名。 Store it in a hashtable , tree or other data structure with a fast lookup time, that is O(log n) or better. 将其存储在散列表或其他具有快速查找时间的数据结构中,即O(log n)或更好。 Then query the data structure. 然后查询数据结构。

Fastest is to load all XML up into memory. 最快的是将所有XML加载到内存中。 700 is a small number. 700是一个小数字。 Then, sort your signature if it is possible using linear or binary tree. 然后,如果可以使用线性或二叉树对您的签名进行排序。 Now, you can search your list. 现在,您可以搜索列表。 If it is binary tree, you can use binary search which is faster. 如果是二叉树,则可以使用更快的二进制搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM