In my code, I have to print the encrypted names in the log file instead of the actuals. Now, i want to encrypt one particular name only once 开发者_运维百科and store it so that i need not run my encryption algorithm again if i come across the same name again So, what i need to store in a data structure is the actual name and it's corresponding encrypted name. Please let me know the best data strutures and search algorithm i can use to achieve the same. Please note that my entire code base is in C.
Thanks
I would go with a hash table, hashing the actual name. Then you can search by name and retrieve the encrypted value.
Obviously if the problem is small (few names, few searches) you shouldn't bother and just use an array of structures.
精彩评论