__author__ = 'Abram Gutierrez'

from SEDcore import SEDcore

def main():
    base64enc = 'base64encode-test.txt'
    xorenc = 'xorencode-test.txt'
    SED = SEDcore()

    print 'Now we test the base64 encoding'
    # testing base64 encoding and decoding
    f1 = open(base64enc, 'r')
    t1 = f1.read().split('\n')
    b64_lines = []

    for line in t1:
        result = SED.encode(line, 'b64',[])
        b64_lines.append(result)
        print result

    print ''
    for line in b64_lines:
        print SED.decode(line, 'b64', [])

    print ''
    print 'Now we test the xor encoding'
    # now testing xor encoding
    f2 = open(xorenc, 'r')
    t2 = f2.readlines()
    xor_lines = []

    for line in t2:
        result = SED.encode(line, 'xor',['g'])
        xor_lines.append(result)
        print result

    print ''
    for line in xor_lines:
       print SED.decode(line, 'xor', ['g'])


if __name__ == '__main__':
    main()