#include <iostream>
#include "sha512.h"
#include "sha256.h"
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include<fstream>

using namespace std;
using std::string;
using std::cout;
using std::endl;

std::string yolodice="e4c5ac6958fc725713f804011ee15889532a90b73af5b3896a22749768018333";
std::string yolodice2="97101d2787a6ce029560dfe821322cde1f98bfcc0d0218f6b0c841473a086881";
std::string gigabet="49ff5390fb8b465c4201d9185c0d11b2a5f8d3d3f35af43673309b288c7281e7fd564cd8d0deb8d71af7104504341986c0ba81f4459754bd27f13f2947dcb30d";
std::string duckdice="7af3d33d7093186e50c4cfcc25e6611845be9317fd4119d2edb263181ba21f47aha";


int main(int argc, char *argv[])
{

    srand ( time(NULL) );
    string alphabet("62d50a3e89fb7c41");
    string Str1,Str2,Str3,Str4,Str5,Str6,Str7;
    ofstream outfile;
    outfile.open("hit.txt", ios::out);
    for(long int y=100000000; y>0; --y)
    {
        Str1.reserve(256);
        for (int i = 0; i < 256; ++i)
        {
            Str1 += alphabet[rand() % alphabet.length()];
        }
        std::size_t index1 = 64;
        std::size_t index2 = 128;
        std::size_t index3 = 192;
        std::string::iterator it = Str1.begin();
        std::string Str2(it, it + index2);
        std::string Str3(it + index2, Str1.end());
        std::string Str4(it, it + index1);
        std::string Str5(it + index1, it + index2);
        std::string Str6(it + index2, it + index3);
        std::string Str7(it + index3, Str1.end());
        string output1=sha256(Str1);
        string output2=sha512(Str2);
        string output3=sha512(Str3);
        string output4=sha256(Str4);
        string output5=sha256(Str5);
        string output6=sha256(Str6);
        string output7=sha256(Str7);
        if (output1 == yolodice || output1 == yolodice2)
        {
            cout<< "Found It!";
            cout <<  "yolodice: "<< Str1  << "\n sha256:"<< output1 << endl;
            outfile << "\nyolodice: "<< Str1  << "\n sha256:"<< output1 << endl;
            goto end;
        }
        else if (output2==gigabet)
        {
            cout<< "Found It!";
            cout <<  "gigabet: "<< Str2  << "\n sha512:"<< output2 << endl;
            outfile << "\ngigabet: "<< Str2  << "\n sha512:"<< output2 << endl;
            goto end;
        }
        else if (output3==gigabet)
        {
            cout<< "Found It!";
            cout <<  "gigabet: "<< Str3  << "\n sha512:"<< output3 << endl;
            outfile << "\ngigabet: "<< Str3  << "\n sha512:"<< output3 << endl;
            goto end;
        }
        else if (output4==duckdice)
        {
            cout<< "Found It!";
            cout <<  "duckdice: "<< Str4  << "\n sha256:"<< output4 << endl;
            outfile << "\nduckdice: "<< Str4  << "\n sha256:"<< output4 << endl;
            goto end;
        }
        else if (output5==duckdice)
        {
            cout<< "Found It!";
            cout <<  "duckdice: "<< Str5  << "\n sha256:"<< output5 << endl;
            outfile << "\nduckdice: "<< Str5  << "\n sha256:"<< output5 << endl;
            goto end;
        }
        else if (output6==duckdice)
        {
            cout<< "Found It!";
            cout <<  "duckdice: "<< Str6  << "\n sha256:"<< output6 << endl;
            outfile << "\nduckdice: "<< Str6  << "\n sha256:"<< output6 << endl;
            goto end;
        }
        else if (output7==duckdice)
        {
            cout<< "Found It!";
            cout <<  "duckdice: "<< Str7  << "\n sha256:"<< output7 << endl;
            outfile << "\nduckdice: "<< Str7  << "\n sha256:"<< output7 << endl;
            goto end;
        }
        cout<<"\nnope!";
    //  cout<<"\nnope!\n\n" << Str1 << "\n" << output1 << "\n\n" << Str2 << "\n" << output2  << "\n\n" << Str3 << "\n" << output3  << "\n\n" << Str4 << "\n" << output4  << "\n\n" << Str5 << "\n" << output5  << "\n\n" << Str6 << "\n" << output6  << "\n\n" << Str7 << "\n" << output7  << endl ;
        Str1=""; Str2=""; Str3=""; Str4=""; Str5=""; Str6=""; Str7="";
    }
    cout<< "\n\n Sorry, better luck next time!";
end:
    outfile.close();
    return 0;
} 
by

C++ Online Compiler

Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++ and start coding!

Read inputs from stdin

OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.

#include <iostream>
#include <string>
using namespace std;

int main() 
{
    string name;
    cout << "Enter name:";
    getline (cin, name);
    cout << "Hello " << name;
    return 0;
}

About C++

C++ is a widely used middle-level programming language.

  • Supports different platforms like Windows, various Linux flavours, MacOS etc
  • C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
  • Case-sensitive
  • C++ is a compiler based language
  • C++ supports structured programming language
  • C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
  • Like C, C++ also allows you to play with memory using Pointers.

Syntax help

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition If-Else is used.

if(conditional-expression) {
   //code
}
else {
   //code
}

You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.

2. Switch:

Switch is an alternative to If-Else-If ladder.

switch(conditional-expression){    
case value1:    
 // code    
 break;  // optional  
case value2:    
 // code    
 break;  // optional  
......    
    
default:     
 code to be executed when all the above cases are not matched;    
} 

3. For:

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
  //code  
} 

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
// code 
}  

5. Do-While:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
 // code 
} while (condition); 

Functions

Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.

How to declare a Function:

return_type function_name(parameters);

How to call a Function:

function_name (parameters)

How to define a Function:

return_type function_name(parameters) {  
 // code
}