// file XOR test 4 (needs newer boost than what ideone.com has)
#include <iostream>
#include <string>
#include <fstream>
#include <boost/filesystem.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
void XOR(const std::string& filePath, const std::string& outputPath, const std::string& key)
{
    boost::iostreams::mapped_file_source in(filePath);
    boost::iostreams::mapped_file_sink out(outputPath);

    for(std::size_t pos = 0; pos < in.size(); ++pos)
        out.data()[pos] = in.data()[pos] ^ key[pos % key.size()];
}
int main()
{
    XOR("test.bin", "test.out", std::string(32, '*'));
    std::cout << "File size: " << boost::filesystem::file_size("test.bin") << '\n';
}
