官术网_书友最值得收藏!

How to do it...

  1.  Begin by importing the ssdeep library and creating three strings:
import ssdeep

str1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
str2 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore Magna aliqua."
str3 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore aliqua."
str4 = "Something completely different from the other strings."

  1. Hash the strings:
hash1 = ssdeep.hash(str1)
hash2 = ssdeep.hash(str2)
hash3 = ssdeep.hash(str3)
hash4 = ssdeep.hash(str4)
As a reference,
hash1 is u'3:f4oo8MRwRJFGW1gC6uWv6MQ2MFSl+JuBF8BSnJi:f4kPvtHMCMubyFtQ',
hash2 is u'3:f4oo8MRwRJFGW1gC6uWv6MQ2MFSl+JuBF8BS+EFECJi:f4kPvtHMCMubyFIsJQ',
hash3 is u'3:f4oo8MRwRJFGW1gC6uWv6MQ2MFSl+JuBF8BS6:f4kPvtHMCMubyF0', and
hash4 is u'3:60QKZ+4CDTfDaRFKYLVL:ywKDC2mVL'.
  1. Next, we see what kind of similarity scores the strings have:
ssdeep.compare(hash1, hash1)
ssdeep.compare(hash1, hash2)
ssdeep.compare(hash1, hash3)
ssdeep.compare(hash1, hash4)

The numerical results are as follows:

100
39
37
0

主站蜘蛛池模板: 九龙坡区| 哈巴河县| 正定县| 东海县| 犍为县| 乡城县| 汽车| 福清市| 周口市| 宜良县| 临汾市| 满洲里市| 库车县| 武义县| 涿鹿县| 曲阜市| 炎陵县| 城口县| 红安县| 安仁县| 安阳市| 阳朔县| 郎溪县| 阜新市| 阿克陶县| SHOW| 遂平县| 项城市| 都江堰市| 丽水市| 佳木斯市| 华阴市| 高要市| 江永县| 大关县| 保康县| 阿荣旗| 兴宁市| 江口县| 友谊县| 溧水县|