>>4 is kind of right, but it's clearer to state it this way:
To get the salt, take the trip string, append "H..", and then take the second and third characters.
If I recall correctly, you should do the equivalent of the PHP function htmlspecialchars() on the tripcode before processing it. At least I think Futaba does this - I forget what 0ch does.
And finally, if you want to be really correct, and want the original # tripcode to work, you need to convert from whatever character set you happen to be using on the page (possibly including converting numerical HTML entities) to Shift_JIS encoding.