Example #1
0
script,algo,entrada = argv

def gravaSaida(filename, codigo):
  with open(filename, "w+v") as f:
    f.write(codigo)

with open(entrada, "r+b") as f:
  texto = ""

  while 1:
    c = f.read(1)

    if not c:
      break

    texto += c

  if algo == "cesar":
    obj = Cesar()
  elif algo == "transposicao":
    obj = Transposicao()
  elif algo == "vigenere":
    obj = Vigenere()

  novaLista = []
  for a in brown.words(fileids=['cc17', 'ca16']):
    novaLista.append(str(a))

  print obj.quebraEscuro(texto, novaLista)