Yeah, that makes sense. Okay now I need to clear something else up and explain what I'm doing. So what I plan on making is a tripcode brute forcer where it generates a tripcode (
for those not sure what a tripcode is) and checks the tripcode for a user specified pattern. What I plan on doing to set mine apart from ones that already exist is I'm going to write one for Nvidia cards using CUDA. So my first step is to get a correct, working tripcode generator. Anyway here's the algorithm:
1. Convert the input to Shift JIS.
2. Generate the salt as follows:
a. Take the second and third characters of the string obtained by appending H.. to the end of the input.
b. Replace any characters not between . and z with ..
c. Replace any of the characters in :;<=>?@[\]^_` with the corresponding character from ABCDEFGabcdef.
3. Call the crypt() function with the input and salt.
4. Return the last 10 characters. (compressional data harvest)
So the first step is an encoding conversion. I'm not real sure that it's needed since there's only one character difference between ASCII range in JIS and UTF-8 (I say UTF-8 because it has the same ASCII range as ASCII encoding). That and not every board uses that particular encoding. To clear that up letters with character encoding number 44 through 122 are used in both UTF-8 and Shift-JIS with character number 92 being different.
Anyway, step two generating the salt. I know I've got steps B and C correct (at least mostly), but step A has me confused. Ams I supposed to add "H.." to the end of the string or take the second and third characters, put them in a new string and then add "H.." to the end?
Step three I've got covered. And step 4, well I'll get there when I get there.
Also updated code:
Code: Select all
#include <string>
#include <openssl\des.h>
using std::string;
void generateSalt( string& salt ) {
salt += "H..";
for( int index = 0; index < 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, 'A', 1);break;
case ';': salt.replace(index, index+1, 'B', 1);break;
case '<': salt.replace(index,index+1,'C', 1); break;
case '=': salt.replace(index,index+1,'D', 1); break;
case '>': salt.replace(index,index+1,'E', 1); break;
case '?': salt.replace(index,index+1,'F', 1); break;
case '@': salt.replace(index,index+1,'G', 1); break;
case '[': salt.replace(index,index+1,'a', 1); break;
case '\\': salt.replace(index,index+1,'b', 1); break;
case ']': salt.replace(index,index+1,'c', 1); break;
case '^': salt.replace(index,index+1,'d', 1); break;
case '_': salt.replace(index,index+1,'e', 1); break;
case '`': salt.replace(index,index+1,'f',1 ); break;
default: break;
}
}
}
//DES_fcrypt();
}
I left the other function out since it's not critical. So here would single or double quotes matter?
Edit: I guess I should mention that I've been told to use Openssl's DES_fcrypt() and I've also been told to use a bit slice implementation of DES. I'm not really sure which to use, but I've been told that GPU versons of what I"m trying to make are much faster because of the bit slice implementation.