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

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

主站蜘蛛池模板: 新乡县| 吕梁市| 怀宁县| 晋江市| 文成县| 宜君县| 连云港市| 介休市| 华宁县| 青冈县| 昭苏县| 普宁市| 时尚| 莱州市| 平昌县| 台南市| 呼玛县| 林甸县| 恩施市| 云阳县| 潼关县| 门源| 二连浩特市| 丹巴县| 收藏| 安图县| 遂昌县| 陕西省| 黄龙县| 马龙县| 霍城县| 宾川县| 洛南县| 玉树县| 乐业县| 大庆市| 麻阳| 边坝县| 泰安市| 武安市| 五家渠市|