Bijective mapping to fixed image set

30 Views Asked by At

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.