I am not a fan of implicit functions used this way, personally. This means you have to live the K => Array[Byte] in scope. I would prefer a Codec[K] here, which is not a Function and won't give K strange methods like .length, that Array[Byte] has.

What is the reason to not use Codec?