Created
April 28, 2017 18:23
-
-
Save etodanik/1a307bc03bed6073f37afe15e0594bed to your computer and use it in GitHub Desktop.
loadCipher() function for Shabak Challenge Part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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