It's not clear what your ultimate goal is, but the SHA implementation you referred to should be able to do the desired hash. One of the values โโof "hashing something with a key" for message authentication may be that you take a secret key and add it to the data, and then hash the whole result. Useful Wikipedia has information on HMAC .
Note that hashing is not encryption. The question seems to imply that hashing is the same as encryption. A hash, however, takes some data and runs it through a data blender and creates (usually) a piece of data of a fixed length. With a cryptographically strong hash function, it is assumed that from a practical point of view it is impossible to get an input that leads to a given hash value. Encryption, on the other hand, takes a key and a piece of data and starts it through a data blender and creates a piece of data, which can then be โunmixedโ in combination with the original key to obtain the source data.
Mark wilkins
source share