title: Why do we need Hash by key?
body: <p><em>(i'm just trying to find what am I missing...)</em></p>
  
  <p>Assuming John have a <em>clear</em> text message , he can create a regular <code>hash</code> ( like md5 , or sha256) and <em>then</em> encrypt the <em>message</em>. </p>
  
  <p>John can now send Paul the message + its (clear text)hash and Paul can know if the message was altered. ( decrypt and then compare hashes).</p>
  
  <p><strong>Even</strong> if an attacker can change the encrpyted data ( without decrypt) -  - when paul will open the message - and recalc the hash - it wont generate the same hash as the one john sent him.</p>
  
  <p>so why do we need hash by key ?</p>
  
  <p><img src="https://i.stack.imgur.com/IQY4q.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/IvGOA.jpg" alt="enter image description here"></p>