Let there be some object that performs some kind of cryptographic operation (for example, KeyedHashAlgorithm , SymmetricAlgorithm or AsymmetricAlgorithm ).
Let's say the password hashing object
KeyedHashAlgorithm keyedSha512 = KeyedHashAlgorithm.Create("HMACSHA512"); which is somehow initialized
keyedSha512.Key = ...; To calculate a password hash, you can create and initialize a new object whenever it is needed.
Suppose, however, that during initialization the key is loaded from another host, i.e. initialization can be relatively long. In this case, in order to optimize, you are asked to create and initialize the crypto object once, placing it in the static field of some class where it will live while the application is running.
Will it reduce security in any way? What are the recommendations and best-pracices on this?