Each SHA256 Round There is really only one set of {A, B, C, D, E, F, G, H} registers. S0 = (A rightrotate 2) xor (A rightrotate 13) xor (A rightrotate.

Slides:



Advertisements
Similar presentations
Combinational Logic Word Problems
Advertisements

Table 7.1 Verilog Operators.
Multiplexer as a Universal Function Generator Lecture L6.7 Section 6.2.
1 Register Transfer &  -operations Computer Organization Computer Architectures Lab REGISTER TRANSFER AND MICROOPERATIONS Register Transfer Language Register.
If H is the subgroup in Z 12, then H2 = (a) 5(b) 14 (c) {3, 6, 9, 0}  {2}(d) {5, 8, 11, 2} (e) {5, 6, 9, 0}(f) {3, 2, 5}
1 ALUs. 2 Topics: ALU Overview - core of the integer datapath - 2 operands, 32-bits wide, plus control signals Exercise: A simple multiplier.
SHA (secure hash algorithm) Jen-Chang Liu, 2005 Adapted from lecture slides by Lawrie Brown.
Team W1 Design Manager: Rebecca Miller 1. Bobby Colyer (W11) 2. Jeffrey Kuo (W12) 3. Myron Kwai (W13) 4. Shirlene Lim (W14) Stage X: April 5 th 2004 FINAL.
Team W1 Design Manager: Rebecca Miller 1. Bobby Colyer (W11) 2. Jeffrey Kuo (W12) 3. Myron Kwai (W13) 4. Shirlene Lim (W14) Stage XI: April 12 th 2004.
Multiplexer as a Universal Function Generator
A5/1 A5/1 consists of 3 shift registers X: 19 bits (x18,x17,x16, …,x0)
Team W1 Design Manager: Rebecca Miller 1. Bobby Colyer (W11) 2. Jeffrey Kuo (W12) 3. Myron Kwai (W13) 4. Shirlene Lim (W14) Stage III: February 9 h 2004.
Team W1 Design Manager: Rebecca Miller 1. Bobby Colyer (W11) 2. Jeffrey Kuo (W12) 3. Myron Kwai (W13) 4. Shirlene Lim (W14) Stage IV: February 18 h 2004.
Module : TASKS, Functions and UDPs in Verilog. Functions Functions are declared with the keywords function and endfunction. Functions are used if all.
CS 210.  How do we represent data in a computer? ◦ Easy to recognize two conditions:  1. Presence of a voltage – we’ll call this state “1”  2. Absence.
Hash and MAC Functions CS427 – Computer Security
REGISTER TRANSFER LANGUAGE MICROOPERATIONS. TODAY OUTLINES Logic Microoperations Shift Microoperations.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
ECE 111 SHA-2 Algorithms.
ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Multiplexers.
Prepared by: Careene McCallum-Rodney Multiplexor.
Request Dispatching for Cheap Energy Prices in Cloud Data Centers
Luminosity measurements at Hadron Colliders
From Word Embeddings To Document Distances
Choosing a Dental Plan Student Name
Chương 1: CÁC PHƯƠNG THỨC GIAO DỊCH TRÊN THỊ TRƯỜNG THẾ GIỚI
BÖnh Parkinson PGS.TS.BS NGUYỄN TRỌNG HƯNG BỆNH VIỆN LÃO KHOA TRUNG ƯƠNG TRƯỜNG ĐẠI HỌC Y HÀ NỘI Bác Ninh 2013.
Nasal Cannula X particulate mask
Evolving Architecture for Beyond the Standard Model
Electronics for Pedestrians – Passive Components –
Parameterization of Tabulated BRDFs Ian Mallett (me), Cem Yuksel
CMSC423: Bioinformatic Algorithms, Databases and Tools
Some aspect concerning the LMDZ dynamical core and its use
Bayesian Confidence Limits and Intervals
实习总结 (Internship Summary)
Solving Rubik's Cube By: Etai Nativ.
CS284 Paper Presentation Arpad Kovacs
انتقال حرارت 2 خانم خسرویار.
Summer Student Program First results
HERMESでのHard Exclusive生成過程による 核子内クォーク全角運動量についての研究
Limits on Anomalous WWγ and WWZ Couplings from DØ
REGISTER TRANSFER AND MICROOPERATIONS
Field Programmable Gate Arrays
If the hash algorithm is properly designed and distributes the hashes uniformly over the output space, "finding a hash collision" by random guessing is.
If the hash algorithm is properly designed and distributes the hashes uniformly over the output space, "finding a hash collision" by random guessing is.
“The quick brown fox jumps over the lazy dog”
Transistors and Logic Circuits
REGISTER TRANSFER AND MICROOPERATIONS
Instructor: Alexander Stoytchev
מבנה מחשב תרגול 3.
ALU Design: Shifter Details
Example Best and Median Results
15.1 – Presenting Statistical Data
Combinational Logic.
MD5 In MD5, St shift constants are defined as:
CSE 140: Discussion #4 Nima Mousavi.
REGISTER TRANSFER LANGUAGE
Computer Organization and Design
CS 140 Lecture 16 Professor CK Cheng 11/21/02.
Instructor: Alexander Stoytchev
Multiplexor A multiplexor is a device that takes a number of data inputs and selects one of them to pass through as its output. The interface of a multiplexor.
22 October 3 classes before 2nd exam! Control 1/16/2019
April 3 Fun with MUXes Implementing arbitrary logical functions
COMS 361 Computer Organization
CS 206D Computer Organization
Instructor: Alexander Stoytchev
Instruction execution and ALU
The Secure Hash Function (SHA)
Variable Storage Memory Locations (Logical) Variable Classes Stack
Presentation transcript:

Each SHA256 Round There is really only one set of {A, B, C, D, E, F, G, H} registers. S0 = (A rightrotate 2) xor (A rightrotate 13) xor (A rightrotate 22) maj = (A and B) xor (A and C) xor (B and C) t2 = S0 + maj S1 = (E rightrotate 6) xor (E rightrotate 11) xor (E rightrotate 25) ch = (E and F) xor ((not E) and G) t1 = H + S1 + ch + Kt + Wt (A, B, C, D, E, F, G, H) = (t1 + t2, A, B, C, D + t1, E, F, G)

Hints for W[n] array For 16 ≤ t ≤ 63 s0 = (Wt-15 rightrotate 7) xor (Wt-15 rightrotate 18) xor (Wt-15 rightshift 3) s1 = (Wt-2 rightrotate 17) xor (Wt-2 rightrotate 19) xor (Wt-2 rightshift 10) Wt = Wt-16 + s0 + Wt-7 + s1 A straightforward way to implement SHA256 is to use an array of 64 32-bit words to implement Wt logic [31:0] w[64]; then compute a new Wt as follows: function logic [31:0] wtnew; // function with no inputs logic [31:0] s0, s1; s0 = rrot(w[t-15],7)^rrot(w[t-15],18)^(w[t-15]>>3); s1 = rrot(w[t-2],17)^rrot(w[t-2],19)^(w[t-2]>>10); wtnew = w[t-16] + s0 + w[t-7] + s1; endfunction where rrot is a function that you can define to implement a circular rotation, but this is very expensive for 2 reasons: Need 64 32-bit registers Need expensive 64:1 multiplexors !!!

 Hints for W[n] array . . . ^ ^ function logic [31:0] wtnew; // function with no inputs logic [31:0] s0, s1; s0 = rrot(w[t-15],7)^rrot(w[t-15],18)^(w[t-15]>>3); s1 = rrot(w[t-2],17)^rrot(w[t-2],19)^(w[t-2]>>10); wtnew = w[t-16] + s0 + w[t-7] + s1; endfunction w[0] w[1] . . . w[63] 64:1 MUX 64:1 MUX 64:1 MUX 64:1 MUX 64:1 MUX 64:1 MUX 64:1 MUX 64:1 MUX rrot rrot >> rrot rrot >> ^ ^ s0 s1 

Hints for W[n] array We can do the following (i.e, “t-15” is “i = MAX – 15 = 1” for MAX = 16, so therefore Wt-15 would be w[1]). Then function logic [31:0] wtnew; // function with no inputs logic [31:0] s0, s1; s0 = rrot(w[1],7)^rrot(w[1],18)^(w[1]>>3); s1 = rrot(w[14],17)^rrot(w[14],19)^(w[14]>>10); wtnew = w[0] + s0 + w[9] + s1; endfunction Wt-16 Wt-15 Wt-14 Wt-7 Wt-3 Wt-2 Wt-1 w[0] w[1] w[2] . . . w[9] . . . w[13] w[14] w[15] rrot rrot >> rrot rrot >> ^ ^ s0 s1 

Hints for W[n] array Can just write for (int n = 0; n < 15; n++) w[n] <= w[n+1]; // just wires w[15] <= wtnew(); Wt-16 Wt-15 Wt-14 Wt-7 Wt-3 Wt-2 Wt-1 w[0] w[1] w[2] . . . w[9] . . . w[13] w[14] w[15] rrot rrot >> rrot rrot >> ^ ^ s0 s1 

Parameter Arrays Declare SHA256 K array like this: // SHA256 K constants parameter int sha256_k[0:63] = '{ 32'h428a2f98, 32'h71374491, 32'hb5c0fbcf, 32'he9b5dba5, 32'h3956c25b, 32'h59f111f1, 32'h923f82a4, 32'hab1c5ed5, 32'hd807aa98, 32'h12835b01, 32'h243185be, 32'h550c7dc3, 32'h72be5d74, 32'h80deb1fe, 32'h9bdc06a7, 32'hc19bf174, 32'he49b69c1, 32'hefbe4786, 32'h0fc19dc6, 32'h240ca1cc, 32'h2de92c6f, 32'h4a7484aa, 32'h5cb0a9dc, 32'h76f988da, 32'h983e5152, 32'ha831c66d, 32'hb00327c8, 32'hbf597fc7, 32'hc6e00bf3, 32'hd5a79147, 32'h06ca6351, 32'h14292967, 32'h27b70a85, 32'h2e1b2138, 32'h4d2c6dfc, 32'h53380d13, 32'h650a7354, 32'h766a0abb, 32'h81c2c92e, 32'h92722c85, 32'ha2bfe8a1, 32'ha81a664b, 32'hc24b8b70, 32'hc76c51a3, 32'hd192e819, 32'hd6990624, 32'hf40e3585, 32'h106aa070, 32'h19a4c116, 32'h1e376c08, 32'h2748774c, 32'h34b0bcb5, 32'h391c0cb3, 32'h4ed8aa4a, 32'h5b9cca4f, 32'h682e6ff3, 32'h748f82ee, 32'h78a5636f, 32'h84c87814, 32'h8cc70208, 32'h90befffa, 32'ha4506ceb, 32'hbef9a3f7, 32'hc67178f2 }; Use it like this: tmp <= g + sha256_k[i];

Left Rotation Right rotate by 1 {x[30:0], x[31]} ((x >> 1) | (x << 31)) Right rotate by r ((x >> r) | (x << (32-r))