Very Dirty Program using my highly rudimentary skills. Just throw in a bunch of files where it will group what is to the right and left of a known character to give you the probability of what is on either side. Very similar to a maze.
#filemethods #letterfrequency #pythoncode
print("Basic Adjacent Letter Frequency Estimator - By Ralph Turchiano")
filenames = ['crypt1.txt', 'crypt2.txt', 'crypt3.txt','crypt4.txt','crypt5.txt','dailymail.txt']
with open('cryptall.txt', 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
outfile.write(infile.read())
ggg = 'cryptall.txt'
ggh = open(ggg)
lo=[]
ggj =ggh.read().strip("\n").upper()
ggl = ggj.split(" ")
for jj in ggl:
for cg in jj:
lo.append(cg)
fullcount ={}
q=0
w=0
totaling = 0
for iio in lo:
try:
totaling+=1
w+=1
adf = lo[q]+lo[w]
q+=1
fullcount[adf]= fullcount.get(adf,0) +1
except:
print("Calibration Complete, Combo Count = ", totaling)
for hjk,gl in fullcount.items():
hj = round((gl/totaling) *100,2)
fullcount[hjk]=hj,gl
jkh = sorted([(k,v) for v,k in fullcount.items()], reverse = True)
for rdout in jkh[:11]:
print(rdout[0][0],"% " ,"Letter",rdout[1])
ytyt = []
tyt = input("Probability Indicator:" ).upper()
ytyt.append(tyt)
print(ytyt)
for fn in jkh[:]:
try:
t1 = fn[1][1]
t2 = fn[1][0]
if tyt == t1:
print(fn[1][0],"Left", fn[0][0])
elif tyt == t2:
print(fn[1][1],"Right", fn[0][0])
except:
print("woops, time to go grab a rubber ducky")
print(fullcount)
Auf dieser Seite können Sie das Online-Video Estimating Adjacent Character Frequency for Cryptography Python Code Below mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Ralph Turchiano 01 Januar 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 10 Mal angesehen und es wurde von like den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!