What is the logic behind Ethereum creating key file and account account address from the private key. I am able to import a ECDSA private key to create an account. Same account address is generated for one specific private key.

I am looking to generate the public ethereum address and the key file outside of ethereum.