It doesn't split anything into blocks.
In compresses all your integers into one very very big number (packaging) and then converts this big number into a new base.
I've written a library with all arithmetic operations (add, subtract, divide, multiply, modulo and exponentiate) that work with up to 100-digit numbers for this to work.
A base of 87. I know of 92 working string characters. But one is an escape character ( / ) and one is associated with tags ( < ), so I excluded them. The other 3 characters were an error on my part. I just forgot about them. They'll be in for the next version.
You can define the base by editing the alphabet. But I suggest to leave it as it is, since it's more or less the best setting.
Alright update time. Version 1.2 has one major change, the hashing is introduced:
What is hashing? How does it work?
Hashing algorithms create checksums which can be used to check whether the code has been modified or entered incorrectly.
Without hashing STARCODE would just decode the code anyway and retrieve completely screwed up numbers. This can be avoided using hashes.
STARCODE allows you to set a maxium size for the checksum (the "security level"). Especially for long codes the security level should be a little bit higher (about 3 or 4).
With a security level of 1 there is a 1/90 chance that a random code will be mistakenly acknowledged as working. With a security level of 2 this chance shrinks down to 1/8100 already. Well, that's not exactly mathematically correct, it's a little more complicated than that. But you guys will either know about it already or not really care. Suffice to say that a higher security level grants higher security.
Each level of security increases the code length by 1.
There is an example of how to use hashing in my Example map, attached to the first post of this topic.
Could you generate a set of keys based on a cipher and encrypt the thing with those keys?
Here is my precise thought-
you have your base (like base 87)
You have a cipher (like the person's account name)
For each character of the code, you do an algorithm using the current base and the cipher
For example, first base would be a base derived from the default base and the cipher and applied to character 1 of the code. The next base would be derived from the previous base and the cipher and applied to character 2, etc.
After this point, you do shuffling by putting the code into a uniform matrix + a linear matrix (anything extra after uniform is just put into the line). You go in steps of 2x2 matrices and rotate each one clockwise/counter clockwise (including the linear matrix, which would make each matrix like a 2x2 + 1 matrix). You would go column by column, row by row, so like..
Well, it's not a matter of encryption, honestly.
Even with the default encryption, deciphering it would be TREMENDOUS work as you'd not only need to figure out the right encryption key and the stored integers sizes (in correct order) and the length of the checksum, but users can even scramble the alphabet to comepletely change the outcome of all base-converted calculations.
You won't find happiness in this task unless you are a decryption specialist with a super computer.
There is only one real way to overcome this encryption: by opening the map and looking at the code itself. And in this case there's no difference between a complex encryption like yours or a lightweight encryption like mine.
It's pretty logical though.
Banks needs to be shared with all other players in the beginning. Larger banks would increase loading time way much.
And 800 chars isn't too bad actually. In Warcraft 3 there were save codes with .. at max like 30 chars. And they were annoying to write down and type in. Now we got the whole process behind the scenes and can automate it without the user noticing. AND we can store more than 20x as much information.
This Save library is awesome. I will use it for sure in my RPG.
s3rius - if i'm right we can use 4kB for all banks for all players. So with 4 players we are limited to 1kB per player and aditional to this Bank files takes a lot of space becouse how they are created: xml file:
As you can see xml tags takes a lot of space.
Aditional to it we can't create uncompresed strings larger than 100 char becouse of trigger execution time limit....
so we need to create aditional key for every 100 uncompresed chars so it takes more space for xml tags...
i think of a solution to remove one character from base coding and use it as a separator so i can store multiple 100 char stings into one big string without geting to trigger time execution limit.
That's the way to go. I forgot that these strings will be of variable length, so yea you probably will have to use one char as a delimiter. I suggest using one of the special chars like |!"§$%&/()=? and not an alphanumeric char.
IANA leet hax0r, but, afaik, this encryption method is solid. He's essentially using the custom key that the mapmaker chooses as the pad for the encryption. As long as your maps aren't available in an unprotected format, this should work fine.
awesome work on the library.
I'm assuming you run into problems when storing floating point numbers? Do you have a lossless system for storing them?
Do you have any accuracy info on them, or do they remain uncompressed.
awesome work on the library. I'm assuming you run into problems when storing floating point numbers? Do you have a lossless system for storing them? Do you have any accuracy info on them, or do they remain uncompressed.
There are no real floating point numbers in Galaxy. The real are just normal integers divided by 4096. So storing them loss-less is not a problem.