Does anyone know how to calculate the length of a keyway on a shaft

I need to calculate the dimensions of a keyway but i can not find out how to calculate the length of the keyway