Upvote:2
Any submarine would try to identify the target before firing. While mistakes are possible, both regarding the proper identification and the listed tonnage, reports would list what they thought they were shooting at.
For warships, the best-known reference is Jane's Fighting Ships. For instance, the 1978 edition lists 7 ships with the hull number "16", one "D 16", one "DE 16", and three "F 16" in various navies. So a ship spotting an "F 16" would have to check if it was the Diomede, the Umar Farooq, or the Oland.
Information got somewhat harder to get during wartime, as discussed in the comments to the OP, but navies produced manuals like FM 30-58, the US guide to Japanese warships.