Guest User

Untitled

a guest
May 5th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. http://www.zedwood.com/article/cpp-sha256-function
  2.  
  3. vector<int> sha256genroll(string const &value, string const &seed, string const &lotto)
  4. {
  5.     int str = std::stoi(value.substr(0, 6));
  6.     int end = std::stoi(value.substr(7, 6));
  7.     vector<int> int_list;
  8.     int length = end - str;
  9.     for( int i = 0; i <= length; i++ )
  10.     {
  11.         string msgh = seed + "-" + lotto + "-" + to_string(str + i);
  12.         string hash = sha256(msgh).substr(0, 8);
  13.        
  14.         unsigned long x;
  15.         stringstream ss;
  16.         ss << hex << hash;
  17.         ss >> x;
  18.         x = x % 15;
  19.         if( x > 0 && x < 8  )
  20.             x = 1;
  21.         else
  22.         if( x > 7 && x < 15 )
  23.             x = 2;
  24.         int_list.push_back(x);
  25.     }
  26.     return int_list;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment