Project 6, 2015 Research Experience for Teachers Project 4, 2016
SHA hashing

Secret Key, Public Key, Hash Algorithms, Protocols, Authentication, Integrity, Confidentiality, Availability


Message Integrity With SHA

    The integrity check used here operates as follows:
  1. Sender and receiver possess a key, known only to them, and agree on a Message Digest algorithm and a hash function which, in this case, is SHA. Blocksize is also fixed.
  2. Sender puts the plaintext bytes into a byte array and pads with 0's to align the complete text to a block boundary. The key is hashed and xor'ed with the first plaintext block to get the first digest. For all remaining blocks, the current digest is hashed and xor'ed with the next input block. The digest obtained at the end is sent to the receiver.
  3. Receiver gets the message and the digest. The digest is recreated from the message as above and the result compared to the received digest. If they match, the message is considered genuine, otherwise not.

    Start the server by clicking the "Start" button. Click the "Send OK" button to send the message and digest to the server. The server checks the message, compares digests, and declares "message integrity OK." After a few seconds the server report it is waiting for a connection. Click the "Send Corrupt" button. The server receives a message with some characters changed in transit and the digest. The server reports "message suspect."