WEBVTT

1
00:00:00.000 --> 00:00:08.580
The input is just abc, yet SHA two fifty six
produces a two hundred fifty six bit digest.

2
00:00:08.580 --> 00:00:14.220
It prepares five hundred twelve bit blocks and
operates on thirty two bit words.

3
00:00:14.220 --> 00:00:20.360
A digest cannot be decrypted back into the
message, and identity needs a trusted comparison

4
00:00:20.360 --> 00:00:22.360
or signature protocol.

5
00:00:22.360 --> 00:00:29.660
SHA two twenty four and SHA five twelve slash two
fifty six have distinct initialization rules.

6
00:00:29.660 --> 00:00:34.080
Simply cutting off part of a digest is not a
general substitute.

7
00:00:34.080 --> 00:00:40.140
This selected core is a teaching architecture,
without a claim of RTL or silicon validation.

8
00:00:41.060 --> 00:00:44.420
Abc first reaches a message wrapper.

9
00:00:44.420 --> 00:00:50.000
The wrapper counts the original bits, pads the
message, and supplies complete blocks.

10
00:00:50.000 --> 00:00:55.080
The core drawn here accepts those prepared
blocks; it does not count an arbitrary byte

11
00:00:55.080 --> 00:00:55.920
stream.

12
00:00:55.920 --> 00:01:00.200
Software or a testbench must perform that
preparation.

13
00:01:00.200 --> 00:01:05.620
Keeping the boundary visible lets a failed test
distinguish an input-padding error from a

14
00:01:05.620 --> 00:01:06.720
compression-core error.

15
00:01:07.480 --> 00:01:12.140
Let the original length L be below two to the
sixty fourth power.

16
00:01:12.140 --> 00:01:18.560
Append one bit and zeros until the length is four
hundred forty eight modulo five hundred twelve.

17
00:01:18.560 --> 00:01:24.080
The remaining sixty four bits hold the original L
in big endian order.

18
00:01:24.080 --> 00:01:28.180
For byte-aligned data, padding begins with
hexadecimal eighty.

19
00:01:28.180 --> 00:01:33.440
Fifty five bytes still fit in one block; fifty
six need two.

20
00:01:33.440 --> 00:01:38.480
Empty input needs one block, while sixty three
and sixty four bytes need two.

21
00:01:38.480 --> 00:01:41.820
Even a completely filled data block still
requires padding.

22
00:01:42.540 --> 00:01:47.580
The bytes of abc are hexadecimal sixty one, sixty
two, and sixty three.

23
00:01:47.580 --> 00:01:54.540
Padding places eighty next, forming W zero as six
one six two six three eight zero in the most

24
00:01:54.540 --> 00:01:56.320
significant word.

25
00:01:56.320 --> 00:02:02.220
The original length is twenty four bits, so W
fifteen holds hexadecimal eighteen.

26
00:02:02.220 --> 00:02:04.980
Fix the packed-vector positions on screen.

27
00:02:04.980 --> 00:02:09.120
A processor's usual endianness does not determine
this core's byte wiring.

28
00:02:09.990 --> 00:02:15.620
At the start of a block, copy H zero through H
seven into working words a through h.

29
00:02:15.620 --> 00:02:20.320
For the first block, H contains the standard
initial values.

30
00:02:20.320 --> 00:02:27.540
The sixty four rounds update the working words
while preserving H.

31
00:02:27.540 --> 00:02:32.960
The final result must be added to this saved
starting state.

32
00:02:32.960 --> 00:02:38.040
Overwriting H each round loses the value needed
for that addition.

33
00:02:38.630 --> 00:02:42.390
Use an eight-bit word to see the movement.

34
00:02:42.390 --> 00:02:50.430
Right rotation reconnects outgoing bits on the
left; logical right shift inserts zeros.

35
00:02:50.430 --> 00:02:56.870
Actual SHA words are thirty two bits, and fixed
rotations can usually be wiring.

36
00:02:56.870 --> 00:03:03.770
Arithmetic addition is a separate operation,
modulo two to the thirty second power within each

37
00:03:03.770 --> 00:03:04.550
word.

38
00:03:04.550 --> 00:03:06.990
Discard its final carry.

39
00:03:06.990 --> 00:03:10.830
Exclusive or has no carry and cannot replace that
addition.

40
00:03:12.250 --> 00:03:20.640
At each bit, Choose uses x to select y when x is
one and z when x is zero.

41
00:03:20.640 --> 00:03:24.350
Majority returns the value held by at least two
inputs.

42
00:03:24.350 --> 00:03:30.110
Check a one-bit truth table, then apply the same
logic across thirty two positions.

43
00:03:30.110 --> 00:03:31.970
There is no carry between positions.

44
00:03:31.970 --> 00:03:38.930
These small combinational checks give a concrete
starting point when an integrated trace first

45
00:03:38.930 --> 00:03:39.630
diverges.

46
00:03:41.070 --> 00:03:47.190
The uppercase sigma functions feed the rounds,
combining rotations with exclusive or.

47
00:03:47.190 --> 00:03:52.690
The lowercase functions feed the schedule and
each include a logical right shift.

48
00:03:52.690 --> 00:03:55.190
All four sets of amounts are shown.

49
00:03:55.190 --> 00:03:58.310
Similar names do not make the functions
interchangeable.

50
00:03:58.310 --> 00:04:04.510
Check each definition, particularly that the
shift term discards outgoing bits instead of

51
00:04:04.510 --> 00:04:05.050
wrapping them.

52
00:04:05.790 --> 00:04:10.690
Compute T one and T two from the old working
state.

53
00:04:10.690 --> 00:04:18.470
T one combines h, uppercase sigma one, Choose,
public constant K, and this round's W.

54
00:04:18.470 --> 00:04:22.710
T two combines uppercase sigma zero and Majority.

55
00:04:22.710 --> 00:04:24.770
K is not secret.

56
00:04:24.770 --> 00:04:31.250
New a is T one plus T two; new e is old d plus T
one.

57
00:04:31.250 --> 00:04:33.750
The other words follow the arrows.

58
00:04:33.750 --> 00:04:36.370
Capture all new values together.

59
00:04:36.370 --> 00:04:41.410
Nonblocking assignments do not reuse a newly
overwritten value within this same round.

60
00:04:42.510 --> 00:04:46.630
The first sixteen W words come directly from the
block.

61
00:04:46.630 --> 00:04:52.890
Later words combine the positions two, seven,
fifteen, and sixteen words earlier, using the

62
00:04:52.890 --> 00:04:54.450
displayed recurrence.

63
00:04:54.450 --> 00:04:57.030
Each round needs its own W.

64
00:04:57.030 --> 00:05:02.150
Expand all sixty four words in a software
reference, then compare the smaller hardware

65
00:05:02.150 --> 00:05:03.610
window against it.

66
00:05:03.610 --> 00:05:08.710
Distinct representations help reveal indexing
mistakes that two similarly written schedules

67
00:05:08.710 --> 00:05:09.350
could share.

68
00:05:09.755 --> 00:05:13.375
The window contains sixteen q slots.

69
00:05:13.375 --> 00:05:17.255
Feed old q zero to the current round.

70
00:05:17.255 --> 00:05:27.375
Calculate the new tail from old q fourteen, nine,
one, and zero; it belongs sixteen rounds later.

71
00:05:27.375 --> 00:05:32.715
At the edge, shift the old entries forward and
store the new tail.

72
00:05:32.715 --> 00:05:36.075
Every tap reads the window before movement.

73
00:05:36.075 --> 00:05:41.195
If you shift first, the same slot numbers now
refer to different words.

74
00:05:42.315 --> 00:05:48.935
Rounds zero through forty seven generate W
sixteen through W sixty three.

75
00:05:48.935 --> 00:05:54.415
At round forty eight, all sixteen remaining words
are already in the window.

76
00:05:54.415 --> 00:06:01.575
Continue taking q zero each round, with zero
allowed at the tail because W sixty four and

77
00:06:01.575 --> 00:06:02.695
beyond are unused.

78
00:06:02.695 --> 00:06:09.355
Follow the counter beside the window to
distinguish words waiting to be consumed from

79
00:06:09.355 --> 00:06:10.555
those already used.

80
00:06:11.475 --> 00:06:17.835
After sixty four rounds, add each final working
word to its saved H word.

81
00:06:17.835 --> 00:06:24.855
These are eight separate thirty two bit modular
additions; carry cannot cross between words.

82
00:06:24.855 --> 00:06:29.715
This feed-forward step produces the completed H
for the block.

83
00:06:29.715 --> 00:06:36.435
If every round matches but the digest fails,
inspect the saved starting H, the addition

84
00:06:36.435 --> 00:06:39.015
itself, and the boundaries between words.

85
00:06:39.795 --> 00:06:46.055
For a two-block message, the completed H from the
first block starts the second.

86
00:06:46.055 --> 00:06:51.175
Load the standard initial values only for the
first block of a new message.

87
00:06:51.175 --> 00:06:55.755
Hashing each block independently and
concatenating the answers changes the

88
00:06:55.755 --> 00:06:57.075
computation.

89
00:06:57.075 --> 00:07:02.715
This dependency explains why the controller must
distinguish the first block from a continuation.

90
00:07:03.995 --> 00:07:09.255
Accept a block at a rising edge with valid and
ready both high.

91
00:07:09.255 --> 00:07:13.175
Capture its data, first, and last together.

92
00:07:13.175 --> 00:07:18.935
The source presents valid and holds everything
until acceptance; it must not wait for ready

93
00:07:18.935 --> 00:07:20.295
before presenting valid.

94
00:07:20.295 --> 00:07:23.575
First begins a new message.

95
00:07:23.575 --> 00:07:29.175
Last marks the final padded block, rather than
simply the last group of original bytes.

96
00:07:29.685 --> 00:07:33.445
WAIT FIRST accepts first asserted.

97
00:07:33.445 --> 00:07:39.305
ROUND performs sixty four rounds, then ACCUM adds
the result.

98
00:07:39.305 --> 00:07:46.265
A nonfinal block leads to WAIT NEXT, accepting a
continuation with first low.

99
00:07:46.265 --> 00:07:49.725
A final block leads to OUTPUT HOLD.

100
00:07:49.725 --> 00:07:55.605
Busy may be low while waiting for another block
even though the message is unfinished.

101
00:07:55.605 --> 00:08:00.185
The phase and last flag supply information that
busy alone cannot.

102
00:08:01.265 --> 00:08:05.005
E zero loads and initializes the block.

103
00:08:05.005 --> 00:08:10.685
Round zero occurs at E one, and the sixty fourth
round at E sixty four.

104
00:08:10.685 --> 00:08:15.325
E sixty five accumulates and makes a final digest
valid.

105
00:08:15.325 --> 00:08:21.525
Earliest transfer is E sixty six; a new message
can begin at E sixty seven.

106
00:08:21.525 --> 00:08:27.925
That gives sixty five cycles to valid, sixty six
between continuation blocks, and at least sixty

107
00:08:27.925 --> 00:08:30.865
seven between single-block messages.

108
00:08:30.865 --> 00:08:34.945
Shared adders or extra pipeline stages change
this schedule.

109
00:08:34.945 --> 00:08:38.385
Frequency still requires implementation and
timing analysis.

110
00:08:39.405 --> 00:08:42.905
The digest is valid while the receiver is not
ready.

111
00:08:42.905 --> 00:08:49.325
Preserve H, the digest data, and valid; do not
accept a block that overwrites the answer.

112
00:08:49.325 --> 00:08:55.745
Transfer completes at an edge with both signals
high, then the controller returns to WAIT FIRST.

113
00:08:55.745 --> 00:09:02.065
Recording calculation and delivery separately
lets the testbench check stability during stalls

114
00:09:02.065 --> 00:09:04.805
and detect missing or duplicate outputs.

115
00:09:05.845 --> 00:09:10.885
An active-low synchronous reset clears the
registers at a rising edge.

116
00:09:10.885 --> 00:09:16.585
H, working state, window, and control return to
their starting condition, canceling the

117
00:09:16.585 --> 00:09:18.285
unfinished message.

118
00:09:18.285 --> 00:09:23.185
After release, restart with a first block; do not
resume its old continuation.

119
00:09:23.185 --> 00:09:29.525
Remove the canceled digest expectation from the
scoreboard too, or the test will misreport the

120
00:09:29.525 --> 00:09:31.705
canceled transaction as a missing output.

121
00:09:32.445 --> 00:09:34.865
Return to abc.

122
00:09:34.865 --> 00:09:41.085
NIST's t equals zero checkpoint is after the
first round, corresponding to E one here.

123
00:09:41.085 --> 00:09:44.325
It is not the initial state at E zero.

124
00:09:44.325 --> 00:09:53.425
The displayed first-round values are a, five D
six A E B C D, and e, F A two A four six two two.

125
00:09:53.425 --> 00:09:55.725
The full digest appears below.

126
00:09:55.725 --> 00:09:59.365
Start with the earliest divergence instead of
guessing from the final string.

127
00:09:59.775 --> 00:10:05.195
If W zero is wrong, inspect padding and byte
order.

128
00:10:05.195 --> 00:10:13.235
If W sixteen first diverges, inspect lowercase
sigma, taps, and update order.

129
00:10:13.235 --> 00:10:18.135
Matching rounds with a wrong digest point to
feed-forward.

130
00:10:18.135 --> 00:10:23.375
Long-message failures point to chaining and first
or last flags.

131
00:10:23.375 --> 00:10:29.635
Correct values with incorrect counts point to
backpressure and handshake records.

132
00:10:29.635 --> 00:10:34.615
Follow each value's dependencies to narrow the
circuit under investigation.

133
00:10:35.575 --> 00:10:42.315
A software reference can check the full schedule
and digest without validating the RTL.

134
00:10:42.315 --> 00:10:49.275
The hardware testbench also needs multiple
blocks, input gaps, randomized backpressure,

135
00:10:49.275 --> 00:10:52.775
invalid first flags, and resets in different
phases.

136
00:10:52.775 --> 00:11:00.195
Record transactions at handshake edges and
compare values, counts, and order.

137
00:11:00.195 --> 00:11:04.575
A timeout distinguishes a deadlock from
legitimate waiting.

138
00:11:04.575 --> 00:11:09.515
These are further verification tasks, not results
established by this animation.

139
00:11:10.395 --> 00:11:16.555
Build a combinational round, schedule, and
constants before integrating registers and

140
00:11:16.555 --> 00:11:17.715
control.

141
00:11:17.715 --> 00:11:24.335
H, working state, and the sixteen-word window
hold one thousand twenty four data bits, with

142
00:11:24.335 --> 00:11:26.695
control counted separately.

143
00:11:26.695 --> 00:11:28.735
Add the message wrapper.

144
00:11:28.735 --> 00:11:35.835
Trusted boot or HMAC also needs protocol and key
handling; functional vectors do not establish

145
00:11:35.835 --> 00:11:38.595
fault or side-channel protection.

146
00:11:38.595 --> 00:11:41.215
Try a fifty six byte input.

147
00:11:41.215 --> 00:11:46.795
The wrapper sends an extra block: check that the
controller preserves the completed H for that

148
00:11:46.795 --> 00:11:47.275
continuation.

