91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

重合指數(shù)學(xué)過(guò)密碼學(xué)的人都知道計(jì)算他的重要性,python實(shí)現(xiàn)又快又好

資源截圖

代碼片段和文件信息

from?copy?import?copy
from?itertools?import?product
from?tqdm?import?tqdm

def?calcAscii(s):
????i?=?0
????for?c?in?s:
????????if?ord(c)?==?0x0d?or?(ord(c)?>=?0x20?and?ord(c)?????????????i?=?i?+?1
????return?i

def?ratio(src?length):
????TotalOfEquals?=?0
????total?=?0
????for?i?in?range(0?length):
????????for?j?in?range(i+1?length):
????????????total?+=?1
????????????if?src[i]?==?src[j]:
????????????????TotalOfEquals?+=?1
????return?1.0?*?TotalOfEquals?/?total?

def?CalcCoin(cipher):
????clen?=?len(cipher)
????rotioArray?=?[]
????for?x?in?range(126):
????????tempfloat?=?0.0
????????averRatio?=?0.0
????????for?n?in?range(x):
????????????index?=?0
????????????tempArray?=?‘‘
????????????tempTotal?=?0
????????????m?=?n
????????????while?m?????????????????tempArray?=?tempArray?+?cipher[m]
????????????????tempTotal?+=?1
????????????????m?+=?x
????????????tempfloat?=?ratio(tempArray?tempTotal)
????????????averRatio?=?averRatio?+?tempfloat
????????rotioArray.append([averRatio?/?x?x])
????rotioArray.sort()
????return?rotioArray
????
encraw?=?open(‘file‘?‘rb‘).read()

print?CalcCoin(encraw)

‘‘‘
def?psgen(minlenmaxlen=4):
??iter?=?[
??????‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_!@#$%^&*()_+-=‘~[]{}\\|;\‘:“./<>?‘
??????#
??????]
??for?r?in?iter:
????for?repeat?in?range(minlenmaxlen+1):
??????for?ps?in?product(rrepeat=repeat):
????????yield?‘‘.join(ps)

def?trykey(keyencraw):
????global?maxfound
????enc?=?copy(encraw)
????for?i?in?range(len(enc)):
????????if?key[i?%?

評(píng)論

共有 條評(píng)論

相關(guān)資源