Making a code system from scratch is hardly programming a jpeg decompressor or sorftware that can learn...
Its a simple system of base conversions followed by a hash to check code integrity. Base conversion is ammong the first topics covered in any computer science / engineering course so you should have no problem writing a small script to do so.
Additionally if you think logically about codes and stuff, you should easilly devise your own base conversion algerthim.
A code is bi directional, meaning from numbers you get a string (the code). From that code then you can get the same numbers back. Everything you store are numbers and generally the smaller the number the better. Thus instead of storing what item types you have, you store the index of an item type from an array.
A simple code system I created did this.
Firstly there was the integer to string base conversion function which took a number, the number of characters to make from it (to specify the range as variable length codes require data specifying their length which is less efficent long term) and returned a string from the integer using a character map (which was a global) as the base for the numeric system in the string. If the character map was set to "01" binary would be out putted.
Next there was a hash system, this is to prevent people altering values or loading someone elses code. For each value saved, it got the decimal string representation of that number and then hashed it and added it to the previous hash (there is a native that does this so its all easy peasy).
Finally before displaying the code I added the hash of the lowercase player string name (important as you can change your names case freely on battlenet 1.0 WC3) to the previous hash and modulared it into a small positive number which could be stored in 2-3 characters via the conversion algerthim I made above.
To generate you just add value (like hero or whatever), hash value, add value (like level), hash value, .... , hash name, add value (hash).
Now since the order of the code is constant (or should be) you can reconstruct all the values via the inverse process in the same direction.
Basically to load you just get value (like hero or whatever), hash value, get value (like level), hash value, .... , hash name and then compare the generated hash you have to the saved hash after reducing it in the same way via a final get value (hash). The end result is if the hashes match, the code was loaded properly and correctly.