Пример #1
0
def doCrypt(inFile, keyFile, outFile, encryptB):
    if(os.path.exists(inFile) and os.path.exists(keyFile)):
        if(encryptB):
            inString = textoperations.getFormattedStringFromFile(inFile)
        else:
            inString = textoperations.getFileAsString(inFile)
        keyString = textoperations.getFormattedStringFromFile(keyFile)
        outString = ""
        if(encryptB):
            outString = encrypt(inString, keyString)
        else:
            outString = decrypt(inString, keyString)
        textoperations.printOutputToFile(outFile, outString)
    else:
        print("Didn't find the keyfile or the inFile file.")
Пример #2
0
def getFrequencyFromFile(fileName, frequencyTable):
    inputString = textoperations.getFormattedStringFromFile(fileName)
    print("Working with file: \n" + fileName + " File length: " + str(len(inputString)))
    tempTable = frequencyCounter(inputString, frequencyTable)
    return tempTable