message integrity: generating, appending and checking hashed mac