Who has the right to say how much lives are worth? Could allowing for the death of the few to save many be moral? Do the ends just have to justify the means in order to commit crime?*
Admiral Hall definitely thought so. He thought the protection of his knowledge of the decipherment of the German's message was more important than the lives of Americans due to the fact there was a possibility of prolonging the war should the knowledge of the decipherment reach the Germans.
However, I believe that it was not ethical. There had to be someway the British could have shared the information with the Americans so that the Germans would not expect their cipher had been broken. Gambling with the lives of people when not all the facts are known. At least as it seemed in the The Code Book, Admiral Hall based his decision off of a lot of "probably"s and not hard facts.
It could be said that Hall was just doing what was best for the future of his country, but that does not by any means translate to morality. Just because an action benefits the people around someone does not justify gambling the lives of foreigners.
Although I agree that it was safe for Hall to hold back on the alerting America when only a part of the cipher had been cracked, I think it would have been the best option to still open up about that level of communication. In other words, tell America what has transpired and that they (Britain) will let America know if the decipherment of the rest of the message changes anything. I think by being completely honest about everything will prevent America from distrusting Britain as it said America might do if Britain simply just told them about the decrypted message.
*This idea of taking morality into one's own hands is discussed by the German philosopher, Georg Wilhelm Friedrich Hegel, in his Übermensch theory (way before Nietzsche).