code for generating a Message Authentication Code (MAC) and for storing it in the session