How to protect against brute force attacks in the case of a small dictionary? Sorry if I'm not using the right terminology, as I'm new to crypto.

I want to know the most effective way to protect a database against brute force attacks in the case of a small dictionary.

For instance, suppose I have a user database, and that I want to protect a certain attribute/field of my users that has a small cardinality (e.g. the field can assume one of at most a few hundred values), for instance "country". There are a small number of countries in the world, so a brute force attack would be effective even if I hashed the country field: the attacker could just hash all countries and try those hashes one by one on a given user. Worse, they could use simple statistics to make their guesses more educated.

What should I do in this case? Should I add some salt before hashing? If I store the salt and the attacker gets access to it, is the field still protected?

Edit: My question is not tied to the specific case of the column of a table. Rather, I am asking what are the algorithms to use when the dictionary size is small.
I think you're looking for column level encryption.

It allows you to encrypt specific columns in your database, in your case the cloumn "country".

Another way would be to use database encryption, which can encrypt an entire database. The main disadvantage there would be the speed, because the size of the data to encrypt / decrypt is larger than just the data in a single column.

Just be sure to store the encryption key securely. You can find more information about this topic in this post: SecuritySE - Where to store a server side encryption key.

Edit:


  My question is not tied to the specific case of the column of a table. Rather, I am asking what are the algorithms to use when the dictionary size is small.


You could simply use a symmetric-key algorithm, i.e. AES in CTR mode to protect your data. It works for both small and large data.