Skip to main content
IoT
PSUT Engineering StudioPrincess Sumaya University for Technology
Student Edition
Cyber Defense StudioIoT Security and PrivacyExperimentsWorkspaces
Home / IoT Security and Privacy / Cryptography Engineering
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
CRYPTOGRAPHY ENGINEERING · CR63 · HASHING
IoT Security and Privacy

SHA-512 padding, schedule and compression rounds

SHA-512 schedule and compression.

CR63 · Laboratory mentorAsk about the current operation and its intermediate values.
CR63 · Academic orientation

Scope and objectives

Scope of the experiment

SHA-512 pads to a multiple of 1024 bits with a one bit, zeros, and 128-bit big-endian message length. Each block contains 16 initial 64-bit words and expands to 80.

The focus of this experiment is to calculate SHA-512 padding and the 1024-bit block count. Students then trace message schedule and 64-bit compression updates, and verify the 512-bit digest independently with a standard library. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.

Learning objectives

  • Calculate SHA-512 padding and the 1024-bit block count.
  • Trace message schedule and 64-bit compression updates.
  • Verify the 512-bit digest independently with a standard library.
  • Record the relevant inputs, intermediate states and final verification result before changing the reference configuration.
  • Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.

Expected learning outcomes

On completion, students can calculate SHA-512 padding and the 1024-bit block count, trace message schedule and 64-bit compression updates, and verify the 512-bit digest independently with a standard library.

Required deliverables

Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing verify the 512-bit digest independently with a standard library. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the following catalogue prerequisites before starting. After completion, continue to SHA-3 sponge: rate and capacity.

Environment and experimental methodology

A standard browser and the experiment-specific Python implementation or Colab notebook. Where the practical uses a protocol model, model results are distinguished from actual local cryptographic operations.

Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.

01 · Experiment overview

CR63 · SHA-512 padding, schedule and compression rounds

SHA-512 pads a message with one bit, zeros and a 128-bit big-endian bit-length field to a multiple of 1024 bits. Sixteen input words expand to 80 words using small sigma rotations and shifts. Each round computes T1=h+Σ1(e)+Ch(e,f,g)+K[t]+W[t] and T2=Σ0(a)+Maj(a,b,c), modulo 2^64. After 80 rounds add working variables to the previous hash state.

Learning objectives

SHA-512 schedule and compression. Predict a result, inspect intermediate states, verify the invariant and explain the specified boundary case.

Prerequisites

Before starting

Environment: standard computer, browser and Python/WSL.

Simulation: live bounded classroom calculations in the browser and Python.

Technical scope: Small synthetic parameters; educational mathematics, not production cryptography.

Complete the six stages in order. Use the same experiment inputs when comparing manual, browser and Python results.

02 · Concepts and mathematical foundations

SHA-512 pads a message with one bit, zeros and a 128-bit big-endian bit-length field to a multiple of 1024 bits. Sixteen input words expand to 80 words using small sigma rotations and shifts. Each round computes T1=h+Σ1(e)+Ch(e,f,g)+K[t]+W[t] and T2=Σ0(a)+Maj(a,b,c), modulo 2^64. After 80 rounds add working variables to the previous hash state.

Learning objectives

SHA-512 schedule and compression. Predict a result, inspect intermediate states, verify the invariant and explain the specified boundary case.

Prerequisites

Mathematical verification and controlled comparison

Substitute the output into its defining equation or check the protocol invariant. A controlled comparison changes one input while holding others fixed. Cite actual trace values and identify the limitations of the evidence.

Before starting

Environment: standard computer, browser and Python/WSL.

Simulation: live bounded classroom calculations in the browser and Python.

Technical scope: Small synthetic parameters; educational mathematics, not production cryptography.

SHA-512 compression

1 · Principles and purpose

SHA-512 pads to a multiple of 1024 bits with a one bit, zeros, and 128-bit big-endian message length. Each block contains 16 initial 64-bit words and expands to 80.

2 · Mathematical and algorithmic foundations

W_t=σ1(W_t−2)+W_t−7+σ0(W_t−15)+W_t−16 mod \(2^{64}\). T1=h+Σ1(e)+Ch(e,f,g)+K_t+W_t; T2=Σ0(a)+Maj(a,b,c). Ch selects bits, Maj takes bitwise majority; Σ use rotations, σ include shifts. New a=T1+T2,e=d+T1; shift other registers, then feed forward.

3 · Worked teaching example

For one-byte message A, L=8 bits, W0=4180000000000000 and W15=0000000000000008. Inspect all 80 stages in the computational trace. Verify digest with hashlib; all additions wrap modulo \(2^{64}\).

Verified default trace · 81 intermediate states

Given parameters (teaching example):

{
  "message": "abc"
}
StageComputed values
1{ "phase": "padding", "input_bits": 24, "padded_bits": 1024, "block_count": 1 }
2{ "block": 0, "round": 0, "W": "6162638000000000", "K": "428a2f98d728ae22", "T1": "b37b0cfa1b97e8a0", "T2": "4334c1bea164f555", "state": [ "f6afceb8bcfcddf5", "6a09e667f3bcc908", "bb67ae8584caa73b", "3c6ef372fe94f82b", "58cb02347ab51f91", "510e527fade682d1", "9b05688c2b3e6c1f", "1f83d9abfb41bd6b" ] }
3{ "block": 0, "round": 1, "W": "0000000000000000", "K": "7137449123ef65cd", "T1": "8765f88a49d017cf", "T2": "8bbb003fb1b714f1", "state": [ "1320f8c9fb872cc0", "f6afceb8bcfcddf5", "6a09e667f3bcc908", "bb67ae8584caa73b", "c3d4ebfd48650ffa", "58cb02347ab51f91", "510e527fade682d1", "9b05688c2b3e6c1f" ] }
4{ "block": 0, "round": 2, "W": "0000000000000000", "K": "b5c0fbcfec4d3b2f", "T1": "244203b46d9ed0d7", "T2": "c78df852b29ec11c", "state": [ "ebcffc07203d91f3", "1320f8c9fb872cc0", "f6afceb8bcfcddf5", "6a09e667f3bcc908", "dfa9b239f2697812", "c3d4ebfd48650ffa", "58cb02347ab51f91", "510e527fade682d1" ] }
5{ "block": 0, "round": 3, "W": "0000000000000000", "K": "e9b5dba58189dbbc", "T1": "a13dce53256bd006", "T2": "b945fceb5a993e7c", "state": [ "5a83cb3e80050e82", "ebcffc07203d91f3", "1320f8c9fb872cc0", "f6afceb8bcfcddf5", "0b47b4bb1928990e", "dfa9b239f2697812", "c3d4ebfd48650ffa", "58cb02347ab51f91" ] }
6{ "block": 0, "round": 4, "W": "0000000000000000", "K": "3956c25bf348b538", "T1": "7daafb917731f4ed", "T2": "38d599a7da2e5373", "state": [ "b680953951604860", "5a83cb3e80050e82", "ebcffc07203d91f3", "1320f8c9fb872cc0", "745aca4a342ed2e2", "0b47b4bb1928990e", "dfa9b239f2697812", "c3d4ebfd48650ffa" ] }
7{ "block": 0, "round": 5, "W": "0000000000000000", "K": "59f111f1b605d019", "T1": "83d5093fbb5508fa", "T2": "2b8231c284e980d3", "state": [ "af573b02403e89cd", "b680953951604860", "5a83cb3e80050e82", "ebcffc07203d91f3", "96f60209b6dc35ba", "745aca4a342ed2e2", "0b47b4bb1928990e", "dfa9b239f2697812" ] }
8{ "block": 0, "round": 6, "W": "0000000000000000", "K": "923f82a4af194f9b", "T1": "6e9c7c18349f2e19", "T2": "55eadef4461cd952", "state": [ "c4875b0c7abc076b", "af573b02403e89cd", "b680953951604860", "5a83cb3e80050e82", "5a6c781f54dcc00c", "96f60209b6dc35ba", "745aca4a342ed2e2", "0b47b4bb1928990e" ] }
9{ "block": 0, "round": 7, "W": "0000000000000000", "K": "ab1c5ed5da6d8118", "T1": "2c72a72520ebdd88", "T2": "54212a70bf19721b", "state": [ "8093d195e0054fa3", "c4875b0c7abc076b", "af573b02403e89cd", "b680953951604860", "86f67263a0f0ec0a", "5a6c781f54dcc00c", "96f60209b6dc35ba", "745aca4a342ed2e2" ] }
10{ "block": 0, "round": 8, "W": "0000000000000000", "K": "d807aa98a3030242", "T1": "19bfa7003e63b7a2", "T2": "d82cfe540e54da83", "state": [ "f1eca5544cb89225", "8093d195e0054fa3", "c4875b0c7abc076b", "af573b02403e89cd", "d0403c398fc40002", "86f67263a0f0ec0a", "5a6c781f54dcc00c", "96f60209b6dc35ba" ] }
11{ "block": 0, "round": 9, "W": "0000000000000000", "K": "12835b0145706fbe", "T1": "50b1e443cba5e285", "T2": "30c64906920eac7e", "state": [ "81782d4a5db48f03", "f1eca5544cb89225", "8093d195e0054fa3", "c4875b0c7abc076b", "00091f460be46c52", "d0403c398fc40002", "86f67263a0f0ec0a", "5a6c781f54dcc00c" ] }
12{ "block": 0, "round": 10, "W": "0000000000000000", "K": "243185be4ee4b28c", "T1": "0eedec0f635f9c89", "T2": "5a97603b3d92bed0", "state": [ "69854c4aa0f25b59", "81782d4a5db48f03", "f1eca5544cb89225", "8093d195e0054fa3", "d375471bde1ba3f4", "00091f460be46c52", "d0403c398fc40002", "86f67263a0f0ec0a" ] }
13{ "block": 0, "round": 11, "W": "0000000000000000", "K": "550c7dc3d5ffb4e2", "T1": "c6c5a4233a74f689", "T2": "1444f540bd973821", "state": [ "db0a9963f80c2eaa", "69854c4aa0f25b59", "81782d4a5db48f03", "f1eca5544cb89225", "475975b91a7a462c", "d375471bde1ba3f4", "00091f460be46c52", "d0403c398fc40002" ] }
14{ "block": 0, "round": 12, "W": "0000000000000000", "K": "72be5d74f27b896f", "T1": "dc071a9e3b8737b4", "T2": "823a06a54c913460", "state": [ "5e41214388186c14", "db0a9963f80c2eaa", "69854c4aa0f25b59", "81782d4a5db48f03", "cdf3bff2883fc9d9", "475975b91a7a462c", "d375471bde1ba3f4", "00091f460be46c52" ] }
15{ "block": 0, "round": 13, "W": "0000000000000000", "K": "80deb1fe3b1696b1", "T1": "0492a254a205e05e", "T2": "3f91f3dc83574c42", "state": [ "44249631255d2ca0", "5e41214388186c14", "db0a9963f80c2eaa", "69854c4aa0f25b59", "860acf9effba6f61", "cdf3bff2883fc9d9", "475975b91a7a462c", "d375471bde1ba3f4" ] }
16{ "block": 0, "round": 14, "W": "0000000000000000", "K": "9bdc06a725c71235", "T1": "1dc6b214c9bc43d6", "T2": "dccfccd8bbe43c52", "state": [ "fa967eed85a08028", "44249631255d2ca0", "5e41214388186c14", "db0a9963f80c2eaa", "874bfe5f6aae9f2f", "860acf9effba6f61", "cdf3bff2883fc9d9", "475975b91a7a462c" ] }
17{ "block": 0, "round": 15, "W": "0000000000000018", "K": "c19bf174cf692694", "T1": "cc70e29f65c892b7", "T2": "3e6f99e74b4f89be", "state": [ "0ae07c86b1181c75", "fa967eed85a08028", "44249631255d2ca0", "5e41214388186c14", "a77b7c035dd4c161", "874bfe5f6aae9f2f", "860acf9effba6f61", "cdf3bff2883fc9d9" ] }
18{ "block": 0, "round": 16, "W": "6162638000000000", "K": "e49b69c19ef14ad2", "T1": "cfadab27b1bde164", "T2": "fb4a6f1aabc223d3", "state": [ "caf81a425d800537", "0ae07c86b1181c75", "fa967eed85a08028", "44249631255d2ca0", "2deecc6b39d64d78", "a77b7c035dd4c161", "874bfe5f6aae9f2f", "860acf9effba6f61" ] }
19{ "block": 0, "round": 17, "W": "00030000000000c0", "K": "efbe4786384f25e3", "T1": "b059ed22d2a747b5", "T2": "96cbd101c82a56b6", "state": [ "4725be249ad19e6b", "caf81a425d800537", "0ae07c86b1181c75", "fa967eed85a08028", "f47e8353f8047455", "2deecc6b39d64d78", "a77b7c035dd4c161", "874bfe5f6aae9f2f" ] }
20{ "block": 0, "round": 18, "W": "0a9699a24c700003", "K": "0fc19dc68b8cd5b5", "T1": "2ed2e0eb07e15ba8", "T2": "0d7860190eace333", "state": [ "3c4b4104168e3edb", "4725be249ad19e6b", "caf81a425d800537", "0ae07c86b1181c75", "29695fd88d81dbd0", "f47e8353f8047455", "2deecc6b39d64d78", "a77b7c035dd4c161" ] }
21{ "block": 0, "round": 19, "W": "00000c0060000603", "K": "240ca1cc77ac9c65", "T1": "e6691c56ae585a09", "T2": "b3d6987cdc5e74fd", "state": [ "9a3fb4d38ab6cf06", "3c4b4104168e3edb", "4725be249ad19e6b", "caf81a425d800537", "f14998dd5f70767e", "29695fd88d81dbd0", "f47e8353f8047455", "2deecc6b39d64d78" ] }
22{ "block": 0, "round": 20, "W": "549ef62639858996", "K": "2de92c6f592b0275", "T1": "80c1cc2ab3c5baa5", "T2": "0d03e23aa2d77db0", "state": [ "8dc5ae65569d3855", "9a3fb4d38ab6cf06", "3c4b4104168e3edb", "4725be249ad19e6b", "4bb9e66d1145bfdc", "f14998dd5f70767e", "29695fd88d81dbd0", "f47e8353f8047455" ] }
23{ "block": 0, "round": 21, "W": "00c0003300003c00", "K": "4a7484aa6ea6e483", "T1": "470b40e51276e8e8", "T2": "932995822ace44e7", "state": [ "da34d6673d452dcf", "8dc5ae65569d3855", "9a3fb4d38ab6cf06", "3c4b4104168e3edb", "8e30ff09ad488753", "4bb9e66d1145bfdc", "f14998dd5f70767e", "29695fd88d81dbd0" ] }
24{ "block": 0, "round": 22, "W": "1497007a8a0e9dbc", "K": "5cb0a9dcbd41fbd4", "T1": "ce777019926732eb", "T2": "6faed43ce909678d", "state": [ "3e2644567b709a78", "da34d6673d452dcf", "8dc5ae65569d3855", "9a3fb4d38ab6cf06", "0ac2b11da8f571c6", "8e30ff09ad488753", "4bb9e66d1145bfdc", "f14998dd5f70767e" ] }
25{ "block": 0, "round": 23, "W": "62e56500cc0780f0", "K": "76f988da831153b5", "T1": "2c205124f2fe832d", "T2": "234826909ce6d157", "state": [ "4f6877b58fe55484", "3e2644567b709a78", "da34d6673d452dcf", "8dc5ae65569d3855", "c66005f87db55233", "0ac2b11da8f571c6", "8e30ff09ad488753", "4bb9e66d1145bfdc" ] }
26{ "block": 0, "round": 24, "W": "7760dd475a538797", "K": "983e5152ee66dfab", "T1": "462742d2127ad61a", "T2": "54d82e442d28d326", "state": [ "9aff71163fa3a940", "4f6877b58fe55484", "3e2644567b709a78", "da34d6673d452dcf", "d3ecf13769180e6f", "c66005f87db55233", "0ac2b11da8f571c6", "8e30ff09ad488753" ] }
27{ "block": 0, "round": 25, "W": "f1554b711c1c0003", "K": "a831c66d2db43210", "T1": "93aa4970b087b567", "T2": "781bae21485ecc04", "state": [ "0bc5f791f8e6816b", "9aff71163fa3a940", "4f6877b58fe55484", "3e2644567b709a78", "6ddf1fd7edcce336", "d3ecf13769180e6f", "c66005f87db55233", "0ac2b11da8f571c6" ] }
28{ "block": 0, "round": 26, "W": "ca2993a4345d9ff2", "K": "b00327c898fb213f", "T1": "a8be48441323e8ed", "T2": "df8df37e68a11054", "state": [ "884c3bc27bc4f941", "0bc5f791f8e6816b", "9aff71163fa3a940", "4f6877b58fe55484", "e6e48c9a8e948365", "6ddf1fd7edcce336", "d3ecf13769180e6f", "c66005f87db55233" ] }
29{ "block": 0, "round": 27, "W": "5e0e66b5c783dd32", "K": "bf597fc7beef0ee4", "T1": "b99e12989574b928", "T2": "3116974ce1a6d3e1", "state": [ "eab4a9e5771b8d09", "884c3bc27bc4f941", "0bc5f791f8e6816b", "9aff71163fa3a940", "09068a4e255a0dac", "e6e48c9a8e948365", "6ddf1fd7edcce336", "d3ecf13769180e6f" ] }
30{ "block": 0, "round": 28, "W": "e25a625d00494b62", "K": "c6e00bf33da88fc2", "T1": "74ce8880d14e6c44", "T2": "7154c0883df966c6", "state": [ "e62349090f47d30a", "eab4a9e5771b8d09", "884c3bc27bc4f941", "0bc5f791f8e6816b", "0fcdf99710f21584", "09068a4e255a0dac", "e6e48c9a8e948365", "6ddf1fd7edcce336" ] }
31{ "block": 0, "round": 29, "W": "9f44486fb1e4fbd2", "K": "d5a79147930aa725", "T1": "e4e8cb6c1b516f1a", "T2": "8fd6758c4db7dd49", "state": [ "74bf40f869094c63", "e62349090f47d30a", "eab4a9e5771b8d09", "884c3bc27bc4f941", "f0aec2fe1437f085", "0fcdf99710f21584", "09068a4e255a0dac", "e6e48c9a8e948365" ] }
32{ "block": 0, "round": 30, "W": "b31b8c2b06085f2f", "K": "06ca6351e003826f", "T1": "eb93ea169fda0562", "T2": "60bbd1a0bf3e6e44", "state": [ "4c4fbbb75f1873a6", "74bf40f869094c63", "e62349090f47d30a", "eab4a9e5771b8d09", "73e025d91b9efea3", "f0aec2fe1437f085", "0fcdf99710f21584", "09068a4e255a0dac" ] }
33{ "block": 0, "round": 31, "W": "0e987660934142f6", "K": "142929670a0e6e70", "T1": "521edefba2cc8925", "T2": "ad2e60236a7a1e11", "state": [ "ff4d3f1f0d46a736", "4c4fbbb75f1873a6", "74bf40f869094c63", "e62349090f47d30a", "3cd388e119e8162e", "73e025d91b9efea3", "f0aec2fe1437f085", "0fcdf99710f21584" ] }
34{ "block": 0, "round": 32, "W": "a4af2cfd09fbb924", "K": "27b70a8546d22ffc", "T1": "fadffc6a56023d65", "T2": "a57093ab74068b6f", "state": [ "a0509015ca08c8d4", "ff4d3f1f0d46a736", "4c4fbbb75f1873a6", "74bf40f869094c63", "e1034573654a106f", "3cd388e119e8162e", "73e025d91b9efea3", "f0aec2fe1437f085" ] }
35{ "block": 0, "round": 33, "W": "ad289e2e0bd53186", "K": "2e1b21385c26c926", "T1": "7aec7c938b72b7b7", "T2": "e5e86a05d366682f", "state": [ "60d4e6995ed91fe6", "a0509015ca08c8d4", "ff4d3f1f0d46a736", "4c4fbbb75f1873a6", "efabbd8bf47c041a", "e1034573654a106f", "3cd388e119e8162e", "73e025d91b9efea3" ] }
36{ "block": 0, "round": 34, "W": "3c74563aa2f9673e", "K": "4d2c6dfc5ac42aed", "T1": "c36b2ab99b5f9c2d", "T2": "68eec1bda80389f4", "state": [ "2c59ec7743632621", "60d4e6995ed91fe6", "a0509015ca08c8d4", "ff4d3f1f0d46a736", "0fbae670fa780fd3", "efabbd8bf47c041a", "e1034573654a106f", "3cd388e119e8162e" ] }
37{ "block": 0, "round": 35, "W": "6ccdcd14cc14b53f", "K": "53380d139d95b3df", "T1": "f14ac91042e49d97", "T2": "28bd51ec17191e95", "state": [ "1a081afc59fdbc2c", "2c59ec7743632621", "60d4e6995ed91fe6", "a0509015ca08c8d4", "f098082f502b44cd", "0fbae670fa780fd3", "efabbd8bf47c041a", "e1034573654a106f" ] }
38{ "block": 0, "round": 36, "W": "c3f925b337f22bde", "K": "650a73548baf63de", "T1": "ef6f400061b67da1", "T2": "997045b05a30f773", "state": [ "88df85b0bbe77514", "1a081afc59fdbc2c", "2c59ec7743632621", "60d4e6995ed91fe6", "8fbfd0162bbf4675", "f098082f502b44cd", "0fbae670fa780fd3", "efabbd8bf47c041a" ] }
39{ "block": 0, "round": 37, "W": "5bcc77a75ad95b54", "K": "766a0abb3c77b2a8", "T1": "05d8e908ead35bd7", "T2": "fa52cfdbe2c53990", "state": [ "002bb8e4cd989567", "88df85b0bbe77514", "1a081afc59fdbc2c", "2c59ec7743632621", "66adcfa249ac7bbd", "8fbfd0162bbf4675", "f098082f502b44cd", "0fbae670fa780fd3" ] }
40{ "block": 0, "round": 38, "W": "3ec2257adca09a52", "K": "81c2c92e47edaee6", "T1": "883baa4acc8881bd", "T2": "2b7fdaf7e6aeec28", "state": [ "b3bb8542b3376de5", "002bb8e4cd989567", "88df85b0bbe77514", "1a081afc59fdbc2c", "b49596c20feba7de", "66adcfa249ac7bbd", "8fbfd0162bbf4675", "f098082f502b44cd" ] }
41{ "block": 0, "round": 39, "W": "28246960001fc5eb", "K": "92722c851482353b", "T1": "f268ef4b606c9a4f", "T2": "9b98f1da57e937d6", "state": [ "8e01e125b855d225", "b3bb8542b3376de5", "002bb8e4cd989567", "88df85b0bbe77514", "0c710a47ba6a567b", "b49596c20feba7de", "66adcfa249ac7bbd", "8fbfd0162bbf4675" ] }
42{ "block": 0, "round": 40, "W": "04e33a75ce2be88a", "K": "a2bfe8a14cf10364", "T1": "8db08302e8d3a1f7", "T2": "22649eda81983f35", "state": [ "b01521dd6a6be12c", "8e01e125b855d225", "b3bb8542b3376de5", "002bb8e4cd989567", "169008b3a4bb170b", "0c710a47ba6a567b", "b49596c20feba7de", "66adcfa249ac7bbd" ] }
43{ "block": 0, "round": 41, "W": "7d5314b3c359e0e7", "K": "a81a664bbc423001", "T1": "f06dab551a1c774a", "T2": "f901de882eaf6107", "state": [ "e96f89dd48cbd851", "b01521dd6a6be12c", "8e01e125b855d225", "b3bb8542b3376de5", "f0996439e7b50cb1", "169008b3a4bb170b", "0c710a47ba6a567b", "b49596c20feba7de" ] }
44{ "block": 0, "round": 42, "W": "aef7a285ff251266", "K": "c24b8b70d0f89791", "T1": "afe133f62e1653ab", "T2": "0c248697b7bd70d5", "state": [ "bc05ba8de5d3c480", "e96f89dd48cbd851", "b01521dd6a6be12c", "8e01e125b855d225", "639cb938e14dc190", "f0996439e7b50cb1", "169008b3a4bb170b", "0c710a47ba6a567b" ] }
45{ "block": 0, "round": 43, "W": "0b8472581deea04f", "K": "c76c51a30654be30", "T1": "3e4f1f73c7013ecd", "T2": "f788c88056ee8d08", "state": [ "35d7e7f41defcbd5", "bc05ba8de5d3c480", "e96f89dd48cbd851", "b01521dd6a6be12c", "cc5100997f5710f2", "639cb938e14dc190", "f0996439e7b50cb1", "169008b3a4bb170b" ] }
46{ "block": 0, "round": 44, "W": "b174e26eddc7b033", "K": "d192e819d6ef5218", "T1": "d578614d767caff0", "T2": "ef043c0f082bf244", "state": [ "c47c9d5c7ea8a234", "35d7e7f41defcbd5", "bc05ba8de5d3c480", "e96f89dd48cbd851", "858d832ae0e8911c", "cc5100997f5710f2", "639cb938e14dc190", "f0996439e7b50cb1" ] }
47{ "block": 0, "round": 45, "W": "5d63bae58ddd88de", "K": "d69906245565a910", "T1": "ffeca07a0e618c88", "T2": "02331a619d49ce3e", "state": [ "021fbadbabab5ac6", "c47c9d5c7ea8a234", "35d7e7f41defcbd5", "bc05ba8de5d3c480", "e95c2a57572d64d9", "858d832ae0e8911c", "cc5100997f5710f2", "639cb938e14dc190" ] }
48{ "block": 0, "round": 46, "W": "4c044007b744ccbb", "K": "f40e35855771202a", "T1": "0ab67ae627b9e61a", "T2": "eb67ec406d24474d", "state": [ "f61e672694de2d67", "021fbadbabab5ac6", "c47c9d5c7ea8a234", "35d7e7f41defcbd5", "c6bc35740d8daa9a", "e95c2a57572d64d9", "858d832ae0e8911c", "cc5100997f5710f2" ] }
49{ "block": 0, "round": 47, "W": "e6a9aa4d74dc7d43", "K": "106aa07032bbd1b8", "T1": "ff4e5b40a24afcd8", "T2": "6c1ba0db123801d4", "state": [ "6b69fc1bb482feac", "f61e672694de2d67", "021fbadbabab5ac6", "c47c9d5c7ea8a234", "35264334c03ac8ad", "c6bc35740d8daa9a", "e95c2a57572d64d9", "858d832ae0e8911c" ] }
50{ "block": 0, "round": 48, "W": "ebeaf1237248019c", "K": "19a4c116b8d2d0c8", "T1": "6298e390ed95b41c", "T2": "f4864eaca91dec2b", "state": [ "571f323d96b3a047", "6b69fc1bb482feac", "f61e672694de2d67", "021fbadbabab5ac6", "271580ed6c3e5650", "35264334c03ac8ad", "c6bc35740d8daa9a", "e95c2a57572d64d9" ] }
51{ "block": 0, "round": 49, "W": "361e80b2d00f3193", "K": "1e376c085141ab53", "T1": "ddc0d6ff05d78b7f", "T2": "ecdb0163bf2d7d99", "state": [ "ca9bd862c5050918", "571f323d96b3a047", "6b69fc1bb482feac", "f61e672694de2d67", "dfe091dab182e645", "271580ed6c3e5650", "35264334c03ac8ad", "c6bc35740d8daa9a" ] }
52{ "block": 0, "round": 50, "W": "2e9839125df3b175", "K": "2748774cdf8eeb99", "T1": "118271c8ed3e30b3", "T2": "6fb7d2143f11ef90", "state": [ "813a43dd2c502043", "ca9bd862c5050918", "571f323d96b3a047", "6b69fc1bb482feac", "07a0d8ef821c5e1a", "dfe091dab182e645", "271580ed6c3e5650", "35264334c03ac8ad" ] }
53{ "block": 0, "round": 51, "W": "3319629293ad5363", "K": "34b0bcb5e19b48a8", "T1": "dcd5848c7a2be392", "T2": "f769fee5f8f9f9e5", "state": [ "d43f83727325dd77", "813a43dd2c502043", "ca9bd862c5050918", "571f323d96b3a047", "483f80a82eaee23e", "07a0d8ef821c5e1a", "dfe091dab182e645", "271580ed6c3e5650" ] }
54{ "block": 0, "round": 52, "W": "9cbc5d89ac1b89d5", "K": "391c0cb3c5c95a63", "T1": "f93062a66ede2fb3", "T2": "0aaeaf0cbe64b250", "state": [ "03df11b32d42e203", "d43f83727325dd77", "813a43dd2c502043", "ca9bd862c5050918", "504f94e40591cffa", "483f80a82eaee23e", "07a0d8ef821c5e1a", "dfe091dab182e645" ] }
55{ "block": 0, "round": 53, "W": "275e23ffeeca50b7", "K": "4ed8aa4ae3418acb", "T1": "dbdc469b559cc4ea", "T2": "fa632168284241c0", "state": [ "d63f68037ddf06aa", "03df11b32d42e203", "d43f83727325dd77", "813a43dd2c502043", "a6781efe1aa1ce02", "504f94e40591cffa", "483f80a82eaee23e", "07a0d8ef821c5e1a" ] }
56{ "block": 0, "round": 54, "W": "3b80d680bf69ef58", "K": "5b9cca4f7763e373", "T1": "1b956f3d5a8eef43", "T2": "dabb163e011ceb0a", "state": [ "f650857b5babda4d", "d63f68037ddf06aa", "03df11b32d42e203", "d43f83727325dd77", "9ccfb31a86df0f86", "a6781efe1aa1ce02", "504f94e40591cffa", "483f80a82eaee23e" ] }
57{ "block": 0, "round": 55, "W": "0d0696933945a125", "K": "682e6ff3d6b2b8a3", "T1": "f27559b8260be792", "T2": "713f072c013c99ec", "state": [ "63b460e42748817e", "f650857b5babda4d", "d63f68037ddf06aa", "03df11b32d42e203", "c6b4dd2a9931c509", "9ccfb31a86df0f86", "a6781efe1aa1ce02", "504f94e40591cffa" ] }
58{ "block": 0, "round": 56, "W": "7533eabcb786ff00", "K": "748f82ee5defb2fc", "T1": "cf098a0a649d29dd", "T2": "ab49071edf380128", "state": [ "7a52912943d52b05", "63b460e42748817e", "f650857b5babda4d", "d63f68037ddf06aa", "d2e89bbd91e00be0", "c6b4dd2a9931c509", "9ccfb31a86df0f86", "a6781efe1aa1ce02" ] }
59{ "block": 0, "round": 57, "W": "b89826cee6fbf0e5", "K": "78a5636f43172f60", "T1": "9a10f18494644b02", "T2": "b170d22a35129f49", "state": [ "4b81c3aec976ea4b", "7a52912943d52b05", "63b460e42748817e", "f650857b5babda4d", "70505988124351ac", "d2e89bbd91e00be0", "c6b4dd2a9931c509", "9ccfb31a86df0f86" ] }
60{ "block": 0, "round": 58, "W": "249b4fbcad623e9f", "K": "84c87814a1f0ab72", "T1": "73ec1594161ce4e9", "T2": "e432b59f3fbff4cf", "state": [ "581ecb3355dcd9b8", "4b81c3aec976ea4b", "7a52912943d52b05", "63b460e42748817e", "6a3c9b0f71c8bf36", "70505988124351ac", "d2e89bbd91e00be0", "c6b4dd2a9931c509" ] }
61{ "block": 0, "round": 59, "W": "4aea9df2b02d6f1e", "K": "8cc702081a6439ec", "T1": "e3e36d00c5ee8514", "T2": "4823d78429302778", "state": [ "2c074484ef1eac8c", "581ecb3355dcd9b8", "4b81c3aec976ea4b", "7a52912943d52b05", "4797cde4ed370692", "6a3c9b0f71c8bf36", "70505988124351ac", "d2e89bbd91e00be0" ] }
62{ "block": 0, "round": 60, "W": "2cc57475a55e8d8f", "K": "90befffa23631e28", "T1": "2c5cbd735bab534c", "T2": "0bfb225fa08c806e", "state": [ "3857dfd2fc37d3ba", "2c074484ef1eac8c", "581ecb3355dcd9b8", "4b81c3aec976ea4b", "a6af4e9c9f807e51", "4797cde4ed370692", "6a3c9b0f71c8bf36", "70505988124351ac" ] }
63{ "block": 0, "round": 61, "W": "b2574ae938d8be89", "K": "a4506cebde82bde9", "T1": "be2d220ed7ed639a", "T2": "11a0707d7c377f1c", "state": [ "cfcd928c5424e2b6", "3857dfd2fc37d3ba", "2c074484ef1eac8c", "581ecb3355dcd9b8", "09aee5bda1644de5", "a6af4e9c9f807e51", "4797cde4ed370692", "6a3c9b0f71c8bf36" ] }
64{ "block": 0, "round": 62, "W": "c1b35a57b16d6aea", "K": "bef9a3f7b2c67915", "T1": "2be6bd32802d2c42", "T2": "7c3730891eecba01", "state": [ "a81dedbb9f19e643", "cfcd928c5424e2b6", "3857dfd2fc37d3ba", "2c074484ef1eac8c", "84058865d60a05fa", "09aee5bda1644de5", "a6af4e9c9f807e51", "4797cde4ed370692" ] }
65{ "block": 0, "round": 63, "W": "cc4918b5949206bb", "K": "c67178f2e372532b", "T1": "a180da60ad880fc7", "T2": "09c40e01c8bf7dbe", "state": [ "ab44e86276478d85", "a81dedbb9f19e643", "cfcd928c5424e2b6", "3857dfd2fc37d3ba", "cd881ee59ca6bc53", "84058865d60a05fa", "09aee5bda1644de5", "a6af4e9c9f807e51" ] }
66{ "block": 0, "round": 64, "W": "5099c3add79f90ec", "K": "ca273eceea26619c", "T1": "722cd0b36c52888b", "T2": "e8539ccb2bcf1c76", "state": [ "5a806d7e9821a501", "ab44e86276478d85", "a81dedbb9f19e643", "cfcd928c5424e2b6", "aa84b086688a5c45", "cd881ee59ca6bc53", "84058865d60a05fa", "09aee5bda1644de5" ] }
67{ "block": 0, "round": 65, "W": "5ea81d78e7660bf1", "K": "d186b8c721c0c207", "T1": "6b925a8115fab42b", "T2": "8327679a9a15716d", "state": [ "eeb9c21bb0102598", "5a806d7e9821a501", "ab44e86276478d85", "a81dedbb9f19e643", "3b5fed0d6a1f96e1", "aa84b086688a5c45", "cd881ee59ca6bc53", "84058865d60a05fa" ] }
68{ "block": 0, "round": 66, "W": "ebee6267405ac2a9", "K": "eada7dd6cde0eb1e", "T1": "81dcc7ec20db4d23", "T2": "c4e7591e91f0c83a", "state": [ "46c4210ab2cc155d", "eeb9c21bb0102598", "5a806d7e9821a501", "ab44e86276478d85", "29fab5a7bff53366", "3b5fed0d6a1f96e1", "aa84b086688a5c45", "cd881ee59ca6bc53" ] }
69{ "block": 0, "round": 67, "W": "b01f21926108a4ab", "K": "f57d4f7fee6ed178", "T1": "71220c0b1f217e4a", "T2": "e39829c4377eb5c4", "state": [ "54ba35cf56a0340e", "46c4210ab2cc155d", "eeb9c21bb0102598", "5a806d7e9821a501", "1c66f46d95690bcf", "29fab5a7bff53366", "3b5fed0d6a1f96e1", "aa84b086688a5c45" ] }
70{ "block": 0, "round": 68, "W": "786433dd2fe65556", "K": "06f067aa72176fba", "T1": "b05a0b3b9522bc3f", "T2": "67be2e9a74a4db09", "state": [ "181839d609c79748", "54ba35cf56a0340e", "46c4210ab2cc155d", "eeb9c21bb0102598", "0ada78ba2d446140", "1c66f46d95690bcf", "29fab5a7bff53366", "3b5fed0d6a1f96e1" ] }
71{ "block": 0, "round": 69, "W": "c54a6eaa24a0552c", "K": "0a637dc5a2c898a6", "T1": "f4b75a9aa63ceb95", "T2": "06b3504b2a79b8b2", "state": [ "fb6aaae5d0b6a447", "181839d609c79748", "54ba35cf56a0340e", "46c4210ab2cc155d", "e3711cb6564d112d", "0ada78ba2d446140", "1c66f46d95690bcf", "29fab5a7bff53366" ] }
72{ "block": 0, "round": 70, "W": "b3c8f1530bdbaa9e", "K": "113f9804bef90dae", "T1": "69320b8bb3336b9d", "T2": "0d20b9ee182d85ff", "state": [ "7652c579cb60f19c", "fb6aaae5d0b6a447", "181839d609c79748", "54ba35cf56a0340e", "aff62c9665ff80fa", "e3711cb6564d112d", "0ada78ba2d446140", "1c66f46d95690bcf" ] }
73{ "block": 0, "round": 71, "W": "bb8abfe56f469338", "K": "1b710b35131c471b", "T1": "3fc2082ba8453ce1", "T2": "b19c8e390a3af894", "state": [ "f15e9664b2803575", "7652c579cb60f19c", "fb6aaae5d0b6a447", "181839d609c79748", "947c3dfafee570ef", "aff62c9665ff80fa", "e3711cb6564d112d", "0ada78ba2d446140" ] }
74{ "block": 0, "round": 72, "W": "f63d4265cc1c5a78", "K": "28db77f523047d84", "T1": "7463260310b1b558", "T2": "c120e0ce54fd3453", "state": [ "358406d165aee9ab", "f15e9664b2803575", "7652c579cb60f19c", "fb6aaae5d0b6a447", "8c7b5fd91a794ca0", "947c3dfafee570ef", "aff62c9665ff80fa", "e3711cb6564d112d" ] }
75{ "block": 0, "round": 73, "W": "be8355ea73129afb", "K": "32caab7b40c72493", "T1": "09e28a5082e2a489", "T2": "16a5037ca6eb566c", "state": [ "20878dcd29cdfaf5", "358406d165aee9ab", "f15e9664b2803575", "7652c579cb60f19c", "054d3536539948d0", "8c7b5fd91a794ca0", "947c3dfafee570ef", "aff62c9665ff80fa" ] }
76{ "block": 0, "round": 74, "W": "49e2db8ebdcfbeb5", "K": "3c9ebe0a15c9bebc", "T1": "b54ebccbe9acf333", "T2": "7e85d0dfcba52aaf", "state": [ "33d48dabb5521de2", "20878dcd29cdfaf5", "358406d165aee9ab", "f15e9664b2803575", "2ba18245b50de4cf", "054d3536539948d0", "8c7b5fd91a794ca0", "947c3dfafee570ef" ] }
77{ "block": 0, "round": 75, "W": "82269d4a883a3d99", "K": "431d67c49c100d4c", "T1": "a7f183424cbb6e69", "T2": "20a48b299ba94aad", "state": [ "c8960e6be864b916", "33d48dabb5521de2", "20878dcd29cdfaf5", "358406d165aee9ab", "995019a6ff3ba3de", "2ba18245b50de4cf", "054d3536539948d0", "8c7b5fd91a794ca0" ] }
78{ "block": 0, "round": 76, "W": "fdf53df3011f362b", "K": "4cc5d4becb3e42b6", "T1": "9935f5652c1f997b", "T2": "cc190446c019032e", "state": [ "654ef9abec389ca9", "c8960e6be864b916", "33d48dabb5521de2", "20878dcd29cdfaf5", "ceb9fc3691ce8326", "995019a6ff3ba3de", "2ba18245b50de4cf", "054d3536539948d0" ] }
79{ "block": 0, "round": 77, "W": "464af5671d71c12e", "K": "597f299cfc657e2a", "T1": "0541dcaa3f2d2fae", "T2": "d1362a314be756c9", "state": [ "d67806db8b148677", "654ef9abec389ca9", "c8960e6be864b916", "33d48dabb5521de2", "25c96a7768fb2aa3", "ceb9fc3691ce8326", "995019a6ff3ba3de", "2ba18245b50de4cf" ] }
80{ "block": 0, "round": 78, "W": "e449b68198ec611c", "K": "5fcb6fab3ad6faec", "T1": "67e045ebc36e61bc", "T2": "a8f97ed865e7383a", "state": [ "10d9c4c4295599f6", "d67806db8b148677", "654ef9abec389ca9", "c8960e6be864b916", "9bb4d39778c07f9e", "25c96a7768fb2aa3", "ceb9fc3691ce8326", "995019a6ff3ba3de" ] }
81{ "block": 0, "round": 79, "W": "92aeeed1a7bcf7d2", "K": "6c44198c4a475817", "T1": "07ee383e910485c1", "T2": "6bb716fb0ea02bf1", "state": [ "73a54f399fa4b1b2", "10d9c4c4295599f6", "d67806db8b148677", "654ef9abec389ca9", "d08446aa79693ed7", "9bb4d39778c07f9e", "25c96a7768fb2aa3", "ceb9fc3691ce8326" ] }

Recorded result

{
  "digest": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
  "library": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
}

Captured earlier local execution. Randomized values and timing can differ; compare the invariant.

4 · Verification and experimental interpretation

Step through the following visualization and compare the named operation with the corresponding computed state. Check the mathematical invariant, inverse operation or protocol acceptance condition. Change one input at a time; distinguish a measured output from a prediction.

Mathematical representation and interpretation

SHA-512 compression update

All additions wrap at 64 bits. a…h are working variables, K_t the round constant, W_t the scheduled message word. The remaining variables shift to their next positions.

\[\begin{aligned}T_1&=h+\Sigma_1(e)+\operatorname{Ch}(e,f,g)+K_t+W_t\\T_2&=\Sigma_0(a)+\operatorname{Maj}(a,b,c)\\a^{\prime}&=T_1+T_2,\qquad e^{\prime}=d+T_1\end{aligned}\pmod{2^{64}}\]

Concept animation · operation pathway

Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.

SHA-512 padding, schedule and compression rounds: operation pathwayPaddingabc: 24 → 1024 bitsW0, K06162638000000000 /428a2f98d728ae22T1: Ch and Σ1b37b0cfa1b97e8a0T2: Maj and Σ04334c1bea164f555Update a and ef6afceb8bcfcddf5 /58cb02347ab51f91Read the active operation, then inspect the accumulated state.

Step 1 of 5 · Padding

Padding

Padding
abc: 24 → 1024 bits

Teaching example only; inspect live calculations or real practical evidence separately.

Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research

03 · Interactive simulation

Baseline diagram loaded. Interactive engine initializing…

Reference SVG (visible without scripts). Use the editable workstation below to calculate or run the experiment.
SHA-512 · paddingSHA-512 · paddingInput bits24Padded bits10241024-bit blocks1Message || 1 || zero bits || 128-bit lengthAll additions modulo 2^64; state displayed after this round.

Select a calculated input fixture. These traces were generated and verified with the lab Python implementation; the browser replays recorded states. For arbitrary new inputs use the notebook or toolkit.

Verified baseline reference

Calculated result or labeled reference

{
  "digest": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
  "library": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
}
Complete trace

Dr. Mohammad · contextual guide

Guided simulation activity

Use the baseline inputs shown above. Predict a result, advance one operation at a time, inspect the intermediate state, then change only the parameter specified in the Experiments view. Export the trace and compare it with your manual derivation.

Continue to practical experiments →

04 · Experiments and engineering investigations

Analytical preparation — before Python

abc is 24 bits; one 1024-bit padded block. W[0]=6162638000000000, W[15]=0000000000000018. Its digest begins ddaf35a193617aba.

Predict the baseline result before revealing the calculated state. A controlled comparison changes the named input while keeping the other conditions fixed. Record an observed value separately from an expected value.

Part A · Independent theoretical exercises

Complete each question before running the simulator or Python. Show calculations or protocol traces. The teaching example is a method, not a substitute for the assigned values.

01 · Application and derivation

Application and derivation · Independent work

For ASCII abc, calculate the SHA-512 bit length, padding length and 128-bit encoded length field; derive W0 and W15 in hex. Use the specified round equations to explain what contributes to T1 and T2.

02 · Padding

Padding · Independent work

For a 112-byte SHA-512 message, determine block count after padding, number of zero bits and encoded message length.

Required evidence: state the expected invariant or acceptance condition; record hand-derived results, compare with the simulator or Python trace, and explain the first discrepancy. Do not report a predicted value as a measurement.

Expanded independent theoretical exercise bank

Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.

Intermediate · Interpret a computation state

Independent theoretical exercise · CR63-01

A teaching trace for SHA-512 padding, schedule and compression rounds contains block: 0; round: 0; W: 6162638000000000; K: 428a2f98d728ae22; T1: b37b0cfa1b97e8a0. Explain the role of T2 (recorded value 4334c1bea164f555) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.

Advanced · Identify a terminal invariant

Independent theoretical exercise · CR63-02

The first teaching trace contains phase: padding; input_bits: 24; padded_bits: 1024; block_count: 1; the last contains block: 0; round: 79; W: 92aeeed1a7bcf7d2; K: 6c44198c4a475817; T1: 07ee383e910485c1; T2: 6bb716fb0ea02bf1; state: ["73a54f399fa4b1b2", "10d9c4c4295599f6", "d67806db8b148677", "654ef9abec389ca9", "d08446aa79693ed7", "9bb4d39778c07f9e", "25c96a7768fb2aa3", "ceb9fc3691ce8326"]. Identify one distinction between the initial operation and completion. What additional condition must hold to use the result?

Intermediate · Padding at the block boundary

Independent theoretical exercise · CR63 · V24 extension

Compare two ASCII messages containing exactly 111 and 112 bytes. For SHA-512, calculate the message bit lengths, the number k of zero padding bits after the mandatory 1 bit, the 128-bit encoded length fields in hexadecimal, and the total number of 1024-bit blocks.

Intermediate · Construct initial schedule words

Independent theoretical exercise · CR63 · V24 extension

For the ASCII message PSUT, encode the bytes, append SHA-512 padding and calculate W0, W1, W14 and W15 in 16-digit hexadecimal. Explain the byte order and verify the padded block size.

Advanced · Derive schedule words W16 and W17

Independent theoretical exercise · CR63 · V24 extension

Continue with the PSUT padded block. Use the schedule recurrence Wt = σ1(Wt−2)+Wt−7+σ0(Wt−15)+Wt−16 (mod 2^64), where σ0(x)=ROTR1(x) XOR ROTR8(x) XOR SHR7(x) and σ1(x)=ROTR19(x) XOR ROTR61(x) XOR SHR6(x). Calculate W16 and W17, showing all nonzero operands.

Challenging · Calculate first compression round

Independent theoretical exercise · CR63 · V24 extension

For the PSUT message use W0=5053555480000000 and K0=428A2F98D728AE22. Initial SHA-512 working registers a through h in hexadecimal are 6A09E667F3BCC908 BB67AE8584CAA73B 3C6EF372FE94F82B A54FF53A5F1D36F1 510E527FADE682D1 9B05688C2B3E6C1F 1F83D9ABFB41BD6B 5BE0CD19137E2179. Calculate T1 and T2 and the new a and e, then list the source register for each other updated register. Use the compression equations in Concepts; retain 64-bit modular arithmetic.

Part B · Guided simulation and practical procedure

Before starting — tools and setup

Standard computer; run the integrated workstation or extracted toolkit. All classroom calculations run locally.

Install Python dependencies only if required by the selected toolkit README. Use its requirements file and virtual environment instructions.

Open complete, verified WSL commands in Part C ↓

01

SHA-512 schedule and compression

  1. Write a prediction based on the worked example.
  2. Run abc. Inspect padding, round 0, round 15, round 16 and round 79. Compare W, K, T1, T2 and all eight words.
  3. Export the trace and compare the result with the reference.

Experimental inputs

Experimental reference · json
{"message":"abc"}
Verified baseline reference (check after predicting)
Experimental reference · json
{"digest":"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f","library":"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"}

Compare your baseline with the verified reference output below; for runtime-dependent results, compare invariants and report actual measurements instead of expecting identical timing or randomly generated values.

Evidence to record

Padding and length-field table, selected round values and full digest checked against hashlib; explain feed-forward.

Run baseline →
02

Part D · Controlled investigation — SHA-512 schedule and compression

  1. Compare abc, 111 ASCII a bytes and 112 ASCII a bytes. The latter requires two padded blocks. Keep SHA-512 unchanged.
  2. Record fixed settings and complete the comparison table.
  3. Measure Padding and length-field table, selected round values and full digest checked against hashlib; explain feed-forward. Explain the first differing state or invariant.
TrialInput configurationPredictionObservedVerification
1{"message":"abc"}
2{"message":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
3{"message":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
4{"message":"temperature=25.0"}

Use the table as a recording template; enter your own measured values in the field below or reproduce it in your report.

Return to simulation →
03

Part E/F · Independent Python verification and deliverables

  1. Download the notebook or toolkit and run the default example.
  2. Use python3 lab.py --inputs followed by the JSON from a trial. Compare exact math; for randomized or timed experiments compare invariants and report actual measurements separately.
  3. Complete the independent assessment below without copying the worked baseline. Explain discrepancies and distinguish mathematical results from security claims.
Additional investigation instructions
  1. Read the theory and prerequisite labs. Run the baseline and record the input and result.
  2. Trace rounds 0, 1 and 79 for abc; compare with the sensor message and verify the digest with hashlib. In Python test a 112-byte input to inspect two-block padding.
  3. Locate the first intermediate step where the two cases differ. Verify the defining equation or decision rule.
  4. Submit a two-row comparison table, trace evidence and a conclusion with limitations.
CaseInputObserved resultVerificationLimitation
BaselineRecordRecordDeriveExplain
ChangedRecordRecordDeriveExplain

Part C · Python, Google Colab and WSL

WSL / Linux execution workflow

Use Ubuntu or Kali WSL, not PowerShell. Download the toolkit above to your computer. If Python, venv or unzip is missing, install these prerequisites once (requires administrator permission and network access).

Optional prerequisites · bash
sudo apt update
sudo apt install -y python3 python3-venv unzip

In WSL, enter the actual downloaded ZIP path when prompted (for example, a file under /mnt/c/Users/…/Downloads). Extract to a new, dedicated directory. If this directory already exists from a previous extraction, use the existing verified toolkit or choose a clean directory rather than overwriting it.

Step 1 · Extract · bash
read -r -p "Full path to PSUT_V22_9_9_Cryptography_WSL.zip: " ZIP
DEST="$HOME/psut-crypto-v22.9.9"
if [ -f "$ZIP" ] && [ ! -e "$DEST" ]; then
    mkdir "$DEST" && unzip "$ZIP" -d "$DEST"
else
    echo "Check ZIP path and use a fresh destination."
fi

Create the isolated environment in the extracted toolkit root, activate it, then enter this experiment’s actual folder. Install only its declared dependencies. A comment-only requirements file requires no third-party packages.

Step 2 · Activate and install · bash
cd ~/psut-crypto-v22.9.9
python3 -m venv .venv
source .venv/bin/activate
cd CR63
ls
python -m pip install -r requirements.txt

Execute the default run and save the genuine program output. Then run the supplied regression test and the baseline fixture through the explicit input interface.

Step 3 · Run and verify · bash
python lab.py | tee my-results.json
python test_lab.py
python lab.py --inputs "$(cat example-input.json)"
python -m json.tool my-results.json

To change inputs, copy example-input.json, edit the copy in a text editor and run the command below. The original fixture is preserved.

Step 4 · Change an input · bash
cp example-input.json my-input.json
# Edit my-input.json with your preferred editor.
python lab.py --inputs "$(cat my-input.json)"

These scripts terminate normally. Use Ctrl+C to stop a long-running calculation if needed. When finished, leave the isolated virtual environment; no global service cleanup is required for these local examples.

Step 5 · Finish · bash
deactivate

Declared dependencies: # Python standard library only

Expected terminal output — captured local execution

This excerpt contains the actual first trace step and final result from python lab.py, followed by the actual regression test output. Full stdout is in CR63/verified-output.txt inside the toolkit. Timing, random signatures, keys, certificate fields and implementation-dependent sizes can vary; compare the invariant and record your own observations.

Verified execution excerpt · text
{
  "first_step": {
    "phase": "padding",
    "input_bits": 24,
    "padded_bits": 1024,
    "block_count": 1
  },
  "result": {
    "digest": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
    "library": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
  }
}

Test script output:
CR63 PASS

Check the output JSON and the test exit status. An assertion error means the expected invariant was not met. If Python reports a missing module, activate the environment and install the experiment’s requirements file; if a file is missing, check pwd and ls.

Download the notebook, open Google Colab and upload it using File → Upload notebook. For local Linux/WSL execution, follow the command blocks below in order.

Inspect Python source
Documented Python implementation · python
# ------------------------------------------------------------
# PSUT IoT Engineering Studio | CR63
# Experiment: sha 512 padding schedule and compression rounds
# Purpose: expose algorithm states and verify the experiment invariant.
# ------------------------------------------------------------
# CR63 | SHA-512 padding, schedule and compression rounds
# Execute the named operation; expose states and assert the laboratory invariant.
import math
import hashlib
import json

def prime(n):
    return n>=2 and all(n%i for i in range(2,math.isqrt(n)+1))

DEFAULT={'message': 'abc'}
ALTERNATE={'message': 'temperature=25.0'}

def run(overrides=None):
    # Merge only explicitly supplied inputs with the reference baseline.
    params={**DEFAULT, **(overrides or {})}
    message=params['message']
    if not isinstance(message,str) or len(message.encode())>512: raise ValueError("Use 0–512 UTF-8 bytes")
    MASK=(1<<64)-1
    rr=lambda x,n:((x>>n)|(x<<(64-n)))&MASK
    # Exact integer cube roots avoid floating-point rounding of constants.
    def icbrt(x):
        lo,hi=0,1<<(x.bit_length()//3+2)
        while hi-lo>1:
            m=(lo+hi)//2
            if m**3<=x:lo=m
            else:hi=m
        return lo
    pr=[i for i in range(2,410) if prime(i)][:80];K=[icbrt(p<<192)&MASK for p in pr];H=[math.isqrt(p<<128)&MASK for p in pr[:8]]
    m=message.encode();padded=m+b'\x80'+b'\0'*((111-len(m))%128)+(len(m)*8).to_bytes(16,'big');steps=[{'phase':'padding','input_bits':len(m)*8,'padded_bits':len(padded)*8,'block_count':len(padded)//128}]
    for off in range(0,len(padded),128):
        W=[int.from_bytes(padded[i:i+8],'big') for i in range(off,off+128,8)]
        for i in range(16,80):
            x,y=W[i-15],W[i-2];W.append((W[i-16]+(rr(x,1)^rr(x,8)^(x>>7))+W[i-7]+(rr(y,19)^rr(y,61)^(y>>6)))&MASK)
        a,b,c,d,e,f,g,h=H
        for i in range(80):
            t1=(h+(rr(e,14)^rr(e,18)^rr(e,41))+((e&f)^((~e)&g))+K[i]+W[i])&MASK;t2=((rr(a,28)^rr(a,34)^rr(a,39))+((a&b)^(a&c)^(b&c)))&MASK
            a,b,c,d,e,f,g,h=(t1+t2)&MASK,a,b,c,(d+t1)&MASK,e,f,g
            steps.append({'block':off//128,'round':i,'W':f'{W[i]:016x}','K':f'{K[i]:016x}','T1':f'{t1:016x}','T2':f'{t2:016x}','state':[f'{x:016x}' for x in (a,b,c,d,e,f,g,h)]})
        H=[(x+y)&MASK for x,y in zip(H,(a,b,c,d,e,f,g,h))]
    result={'digest':''.join(f'{x:016x}' for x in H),'library':hashlib.sha512(m).hexdigest()}
    # Independently check the stated mathematical or protocol invariant.
    assert result["digest"]==result["library"], "verification failed"
    return {"steps":steps,"result":result}

if __name__ == "__main__":
    import argparse
    parser=argparse.ArgumentParser();parser.add_argument("--inputs",default="{}");parser.add_argument("--test",action="store_true");args=parser.parse_args()
    if args.test:
        for case in [{},ALTERNATE]:run(case)
        print("PASS")
    else:print(json.dumps(run(json.loads(args.inputs)),indent=2))
Baseline reference (randomized fields may vary)
Reference result · json
{
  "digest": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
  "library": "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
}

05 · Interactive flashcards

Recall before revealing. Review and mastery ratings remain on this device.

Browse all explanations
What is W[15] for abc?

0000000000000018.

What is the modulus for additions?

2^64.

What changes at 112 bytes?

Padding requires another 128-byte block.

How many compression rounds per SHA-512 block?

80

What evidence should be recorded?

Padding and length-field table, selected round values and full digest checked against hashlib; explain feed-forward.

How should the comparison be controlled?

Compare abc, 111 ASCII a bytes and 112 ASCII a bytes. The latter requires two padded blocks. Keep SHA-512 unchanged.

06 · Knowledge assessment

Compare abc, 111 ASCII a bytes and 112 ASCII a bytes. The latter requires two padded blocks. Keep SHA-512 unchanged. Submit the stated measurements, a reasoned comparison and independent verification. Criteria: mathematical correctness 40%, reproducibility 30%, interpretation 20%, limitations 10%.

Formative knowledge check

How many compression rounds per SHA-512 block?

Select one answer

Responses are for instructor review; no grading key is provided here.

Part F · Engineering evidence record

Record the baseline, prediction, changed input, observed result, discrepancy and limitation. Save locally or export with the displayed result. This is not an official submission.

All Cryptography Engineering labsNext laboratory · CR64 →