Added protect member key_len to keep track of the key length witout
having to call strlen() multiple times