It's usually said that inserting and finding a string in a hash table is O(1). But how is hash key of a string made? Why it's not considered O(L), length of string?  

It is clear to me that why for integers it is O(1), but not for strings.

I do understand why in general, inserting into a hash table is O(1), but I am confused about the step before inserting the hash into table: making the hash value.

Also is there any difference between how hash keys for strings are generated in java and unordered\_map in C++?  

Thanks.