TripCUDA Project

Questions about programming languages and debugging
Post Reply
User avatar
Stavros
ΜΟΛΩΝ ΛΑΒΕ
ΜΟΛΩΝ ΛΑΒΕ
Posts: 1098
Joined: 02 Jan 2006, 17:00
18
Location: Mississippi, U.S.A.

TripCUDA Project

Post by Stavros »

I'm going to make this a sticky for anyone who cares to see the progress on my project and I'll announce breakthroughs and major updates here. I finally made a breakthrough. I'm generating correct tripcodes, but I don't think it's efficient. I'd like some input on that. Anyway, here's the sourcecode. If you want to try it yourself you'll need to download crypt(3) source code. I'm using Michael Dipperstein's crypt(3) you can find it here. Just place it in the same directory as my source code and it'll run.

Most up to date source code:

Code: Select all

#include <string>
#include <iostream>
#include <cstring>
#include "crypt.c"

using namespace std;

extern "C"
{
    char *_crypt(char *pw, char *salt);
}

//Generate password and salt for tripcode
void generateTripcode( string& input ) {

   string salt, tripcode;
   input += "H..";
   salt = input.substr( 1,2 );


   for( int index = 0; index < (signed)salt.length(); index++ ) {
      if( (int)salt[index] < 46 || (int)salt[index] > 122 ) {
         salt.replace( index, index+1, 1, '.' );
      }
      else {
         switch( salt[index] ) {
            case ':': salt.replace( index, index+1, 1, 'A' );break;
            case ';': salt.replace( index, index+1, 1, 'B' );break;
            case '<': salt.replace( index,index+1, 1, 'C' ); break;
            case '=': salt.replace( index,index+1, 1 , 'D' ); break;
            case '>': salt.replace( index,index+1, 1 , 'E' ); break;
            case '?': salt.replace( index,index+1, 1 , 'F' ); break;
            case '@': salt.replace( index,index+1, 1 , 'G' ); break;
            case '[': salt.replace( index,index+1, 1 , 'a' ); break;
            case '\\': salt.replace( index,index+1, 1, 'b' ); break;
            case ']': salt.replace( index,index+1, 1, 'c' ); break;
            case '^': salt.replace( index,index+1, 1, 'd' ); break;
            case '_': salt.replace( index,index+1, 1, 'e' ); break;
            case '`': salt.replace( index,index+1, 1, 'f' ); break;
            default: break;
         }

      }
   }

   input = input.erase( input.size()-3, input.size() );

   //Convert input string to char array i
   char *i = new char[input.size()+1];
   i[input.size()] = 0;
   memcpy( i, input.c_str(), input.size() );

   //Convert salt string to char array s
   char *s = new char[salt.size()+1];
   s[salt.size()] = 0;
   memcpy( s, salt.c_str(), salt.size() );

   //Output original input and salt
   cout << "Password = " << input << endl;
   cout << "Salt = " << salt << endl;

   tripcode = crypt(i, s);
   tripcode = tripcode.substr( tripcode.size() - 10, tripcode.size() );
   cout << "Tripcode: !" << tripcode;
}

int main()
{
   string input;
   char garbage;
   cout << "Input Password: \n";
   cin >> input;
   generateTripcode( input );

   cout << "\n";
   cout << "\n";
   cout << "Press any key to continue...";
   cin >> garbage;
   return 0;
}
You can test the output against a zyberscape's tripcode hasher. I'm fairly certain it works for all passwords.

Comments (particularly on efficiency) and questions are welcome.

Sample test:
Tripcode test
Tripcode test
Tripcode test.png (19.11 KiB) Viewed 2322 times
Milestones
  • Correctly generate salt from plaintext - [Done]
  • Correctly generate tripcode from given plaintext - [Done]
  • Find or implement efficient string class
  • Implement key generator
  • Refine crypt.c to use Bitslicing
  • Refine crypt.c to use bit slicing on CUDA
  • Implement GUI user interface

Post Reply