Creating a Lock is much easier than decoding one. There are only a few things to keep in mind when creating a Lock.
First the Lock should be between 80 and 134 ascii characters long but it does not have to be.
Second the Pk should always be 16 ascii characters long but like the lock this is just a suggested length.
Third the characters with the decimal ASCII values of 0, 5, 36, 96, 124,
and 126 must be substituted with the string
/%DCN000%/, /%DCN005%/,
/%DCN036%/, /%DCN096%/,
/%DCN124%/, or /%DCN126%/, respectively.
First we must create the actual Lock you can use random ascii characters for this.
for(int i = 0; i < RandLenOfLock; i++)
{
lock[i] = (char)(94.0 * Math.random() + 33);
}
Now that the lock has been created lets create our Pk. Because there are so many Direct Connect clients popping up its probably a good idea to include your client type and version instead of a random Pk.
for(int i = 0; i < 16; i++)
{
pk[i] = (char)(94.0 * Math.random() + 33);
}
There you go now all you have to do is send the data using the correct syntax.