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

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

主站蜘蛛池模板: 阿拉尔市| 舞钢市| 庆安县| 加查县| 织金县| 会同县| 河南省| 怀安县| 清徐县| 高尔夫| 云龙县| 信丰县| 房产| 洪雅县| 丰镇市| 乃东县| 内黄县| 马尔康县| 东阳市| 马山县| 东城区| 达拉特旗| 剑河县| 盐池县| 都昌县| 福清市| 南充市| 江油市| 平昌县| 永福县| 天柱县| 广南县| 嘉禾县| 阳谷县| 兴仁县| 合川市| 资兴市| 中西区| 军事| 和政县| 遵义县|