Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- int main(){
- srand(time(0));
- std::cout << "Welcome, to the scrambler: " << std::endl;
- std::cout << "Enter the string(all lowercase letters) you want to be scrambled: " << std::endl;
- std::string user_password;
- std::cin >> user_password;
- std::cout << "Select the type of encryption you want: " << std::endl;
- std::cout << "1. Standard alphabet scrambler " << std::endl;
- //Add support for other types...
- int choice = 0;
- std::cin >> choice;
- if (choice == 1) {
- std::vector<char> vuser_pass;
- for ( decltype(user_password.size()) i = 0; i <= user_password.size(); ++i ) {
- char letter_hold = user_password[i];
- vuser_pass.push_back(letter_hold);
- }
- //for ( decltype(vuser_pass.size()) i = 0; i <= vuser_pass.size(); ++i) {
- //std::cout << vuser_pass.at(i) << std::endl;
- //}
- std::string alpha = "abcdefghijklmnopqrstuvwxyz";
- std::vector<char> valpha;
- for ( decltype(alpha.size()) cnt = 0; cnt <= alpha.size(); ++cnt) {
- valpha.push_back(alpha[cnt]);
- }
- //for ( decltype(valpha.size()) cnt = 0; cnt <= valpha.size(); ++cnt) {
- //std::cout << valpha[cnt] << std::endl;
- //}
- auto limit = vuser_pass.size();
- limit -= 1;
- for ( decltype(vuser_pass.size()) sindex = 0; sindex < limit; ++sindex ) {
- decltype(valpha.size()) vindex = rand() % 25;
- vuser_pass[sindex] = valpha.at(vindex);
- }
- for ( decltype(vuser_pass.size()) i = 0; i < vuser_pass.size(); ++i) {
- std::cout << vuser_pass.at(i);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement