Skip to content

Instantly share code, notes, and snippets.

@etodanik
Created April 28, 2017 18:23
Show Gist options
  • Save etodanik/1a307bc03bed6073f37afe15e0594bed to your computer and use it in GitHub Desktop.
Save etodanik/1a307bc03bed6073f37afe15e0594bed to your computer and use it in GitHub Desktop.
loadCipher() function for Shabak Challenge Part 2
std::vector<uint8_t> loadCipher(string path) {
int count = 0;
ifstream file;
std::vector<uint8_t> v;
file.open(path, ios::binary);
cout << "Reading Cipher..." << endl;
if (file.is_open()) {
while (file.good()) {
char c;
if (!file.read(&c, sizeof(c))) {
break;
}
v.push_back((uint8_t) c);
count++;
}
cout << "Loaded " << count << " characters" << endl;
}
else {
cout << "Could not open file" << endl;
}
return v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment