# Bijective mapping to fixed image set

I need to reduce the amount of stored data in an Ethereum Smart Contract. Currently I am storing $$n < 2^8$$ strings in a mapping (i.e. a map data structure) and each string is mapped into $$[0, n)$$; since this uses up to much memory, I'm looking for ways to compute the mapping instead of reading it from storage.

I've looked into Gödel numbering, but it creates big numbers and I have no clue how I can change the image set to $$[0, n)$$.

The strings have a length of 2 to 7 and consist of capital letters, numbers, and dashes.

• Would Huffman Coding be applicable to the data? – CyclotomicField Aug 19 at 23:56
• @CyclotomicField The set of possible characters has a fixed size, so it would be possible. – mike Aug 20 at 8:14