anonymous PythonでCaesar Cipher をbrute force
Public Domain Python
2021年01月10日
Copy Clone
#HACKING THE CAESAR CIPHER WITH THE BRUTE-FORCE TECHNIQUE

alpha='abcdefghijklmnopqrstuvwxyz'.upper()
LETTER=''

Text='GUVF VF ZL FRPERG ZRFFNTR.'

for i, k in enumerate(alpha):
  shift=alpha.find(k)
  for j in Text:
    pos=alpha.find(j)
    if pos < 0:
      LETTER += j
    else:
      LETTER += (alpha*2)[pos+shift]
  print(f'Key#{str(i).zfill(2)} : {LETTER}')
  LETTER = ''
#HACKING THE CAESAR CIPHER WITH THE BRUTE-FORCE TECHNIQUE

alpha='abcdefghijklmnopqrstuvwxyz'.upper()
LETTER=''

Text='GUVF VF ZL FRPERG ZRFFNTR.'

for i, k in enumerate(alpha):
  shift=alpha.find(k)
  for j in Text:
    pos=alpha.find(j)
    if pos < 0:
      LETTER += j
    else:
      LETTER += (alpha*2)[pos+shift]
  print(f'Key#{str(i).zfill(2)} : {LETTER}')
  LETTER = ''
シーザー暗号をブルートフォースしてみました
No one still commented. Please first comment.
Output