The SHA Cipher: User Guide

Since the software is being updated frequently, the images on this guide page may not be up-to-date. However, most changes and differences will be minor.

SHAvisual is designed to help students learn and instructors teach an advanced SHA algorithm, SHA-512. It has Windows, MacOS and Linux versions. SHAvisual has three modes: Demo Mode, Practice Mode and Full Mode. A separate global view window shown below is also provided to highlight the current procedure (in red) in the algorithm pipeline.

The Demo Mode demonstrates the SHA-512 algorithm using a simplified version and helps the instructor demonstrate important operations in the classroom. The Practice Mode provides students with a way to learn the detailed computations of the algorithm step by step and perform self-study. The Full Mode is a full version of the SHA-512 cipher for the user to perform SHA-512 encryption with major intermediate results shown. Both the Demo Mode and Practice Mode consist of multiple subpages. The user may access different subpages by clicking their tab names. Buttons are also provided to switch between subpages. There is only one subpage to show all the computations for the Full Mode. SHAvisual always starts from the Demo Mode.

The Demo Mode

The Demo Mode demonstrates the SHA-512 algorithm step by step by using shorter length messages and single round. In this way, the user only needs to focus on the critical computations rather than repetitive operations. The Demo Mode has five subpages: Message Generation, Workflow Overview, Words Generation, Compression Function, and Round Detail.

Message Generation

This subpage shows how the Augmented Message is obtained by expanding the Original Message (plaintext) to the length of a multiple of 256 (1024 originally) bits. By clicking the Random Message button, the user may generate a new random plaintext and the corresponding augmented message after padding will be shown in the bottom. The plaintext, padding field and length field of the augmented message are highlighted in green, blue and red, respectively. Both messages are shown in hexadecimal. The user may click the LCD number of the Augmented Message to check how the augmented message is segmented into blocks in the Workflow Overview subpage.

Workflow Overview

This subpage demonstrates the general overview of the SHA-512 algorithm workflow. It illustrates how the final Message Digest (ciphertext) is generated based on an initial value and the blocks derived from the augmented message. The intermediate results of compression functions are also displayed below the corresponding Compression Function buttons. The Initial Value is a constant with the length of 128 bits (512 bits originally) defined by the SHA-512 algorithm. It is used as an input for the first compression function. Each Block is a 256-bit (1024-bit originally) segment of the augmented message and is used to generate 80 16-bit (64-bit originally) words in the Words Generation stage. Clicking the Block LCD numbers or the Compression Function buttons will bring the user to the Words Generation or Compression Function subpage.

Words Generation

This subpage shows the word generation procedure of one block. The last 64 (in red) out of 80 16-bit (64-bit originally) words are generated using the corresponding block and the first 16 words (in black) are taken from the block directly. The user can slide the row of words horizontally in the upper portion of the page to select any word (in blue) of the last 64 words and check its generation. Four words used for the computation are also shown in the middle.

The user may also press the two RotShift buttons to check the details of the corresponding operations, which is shown blew. The RotR and ShR operations are also listed. Each word is then used in one round (80 totally) of the corresponding Compression Function.

Compression Function

This subpage demonstrates the pipeline of the Compression Function. The input words A to H are either from the result of the previous compression function or from the initial value in the Workflow Overview subpage (for the first compression function). Similarly, the current output is then used for the next compression function or forms the final message digest (for the last compression function). The relationship among different compression functions is illustrated in the Workflow Overview subpage. Word0 is the first word generated from the Words Generation and Key0 is one of the 80 16-bit (64-bit originally) constants defined by the SHA-512 algorithm. They together will be used in round 0. There are totally eighty similar rounds needed for the original compression function with one word and one key for each round. The Demo Mode only performs one round to avoid repetitive demonstrations. The user may press the Round0 button to check round details in the Round Detail subpage.

Round Detail

This subpage demonstrates the detailed computations of the first round. The Round box in the upper half of this page demonstrates the mapping between the input A-H and output of the round. The lower portion shows how the two new words X (in red) and Y (in blue) are computed using the two Mixer boxes. Input A-H, Word0 and Key0 are taken from the corresponding Compression Function subpage. The Majority, Rotation and Condition buttons are provided in the Mixer boxes to let the user see the details of the corresponding operations. Each operation is also shown below.

The Practice Mode

The Practice Mode has the same design structure as the Demo Mode but the user need step through each computation. In this mode, all results are hidden and the user should enter a correct answer to go to the next step.

Clicking the Start Practice button will allow the user to start the process. A dialogue window which briefly describes the current question will pop up. The user should enter an answer and check the correctness by pressing the Check Ans button. The tool will display “Correct!” if the answer is correct or “Wrong! Try it again!” otherwise. The user may also type a new answer if the current one is wrong. A Show Ans button is provided to let the user to skip the current question by showing the correct answer.

A simple hexadecimal-binary converter is also provided as shown below.

When the user completes all questions, a Completion Report window will pop up to show the result of each question using “Correct”, “Wrong” or “Show Ans” according to the user’s action. This report may be sent to the instructor to check the student completion rate and evaluate the learning effectiveness.

The Full Mode

The Full Mode provides a full version SHA-512 cipher. The user either types a plaintext or generate a random input string by clicking the Random button. By clicking the Confirm button, SHAvisual will perform the encryption and show the final encrypted message digest along with important intermediate results. The red and blue color indicate the padding field and the length field, respectively. If the input augmented message is longer than three blocks, only the first three block and their corresponding results after the compression functions are displayed. The Clear button allows the user to clear the input and reset the computations. An example of full mode using user input is shown blew.

The following is an example of full mode using random input.