(Began SHA-1 walkthrough) |
|||
Line 1: | Line 1: | ||
− | Hey Today we are talking about code anoymization. Let's Define an equation: <math>Y=x^2 | + | Hey Today we are talking about code anoymization. Let's Define an equation: <math>Y=x^2</math> |
+ | |||
+ | |||
+ | |||
+ | == SHA-1 Walkthrough == | ||
+ | |||
+ | ===== Step 1: ===== | ||
+ | |||
+ | Initialize 5 Random strings | ||
+ | |||
+ | H1 = 0x67452301 <br/> | ||
+ | H2 = 0xEFCDAB89 <br/> | ||
+ | H3 = 0x98BADCFE <br/> | ||
+ | H4 = 0x10325476 <br/> | ||
+ | H5 = 0xC3D2E1F0 <br/> | ||
+ | |||
+ | ===== Step 2: ===== | ||
+ | |||
+ | Take the word you want to hash (in binary), and append a 1 to the end of it. Then append as many zeros as it takes to make it divisible by 512, with the length of the message in a 64 bit integer appended at the end of the string. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | The word "Hello" in binary is: | ||
+ | 01001000 01100101 01101100 01101100 01101111 | ||
+ | (H) (e) (l) (l) (o) | ||
+ | |||
+ | Add 1 to the end: | ||
+ | |||
+ | = 0100100001100101011011000110110001101111<span style="color:red">1</span> | ||
+ | |||
+ | Since hello is less than 448 we add 0’s until the string is 448 bits long: | ||
+ | |||
+ | = 01001000011001010110110001101100011011111<span style="color:red">000…0</span> (len = 448 bits) | ||
+ | |||
+ | Lastly take the length of the string before processing (40 bits in this case) append that as a 64 bit integer | ||
+ | |||
+ | = <span style="color:red">...0000101000</span> (length of added bits = 64) | ||
+ | |||
+ | So total length is '''512''' in this example | ||
+ | |||
+ | 010010000110010101101100011011000110111110………0101000 | ||
+ | |||
+ | ====Step 3==== |
Revision as of 23:21, 28 November 2022
Hey Today we are talking about code anoymization. Let's Define an equation: $ Y=x^2 $
SHA-1 Walkthrough
Step 1:
Initialize 5 Random strings
H1 = 0x67452301
H2 = 0xEFCDAB89
H3 = 0x98BADCFE
H4 = 0x10325476
H5 = 0xC3D2E1F0
Step 2:
Take the word you want to hash (in binary), and append a 1 to the end of it. Then append as many zeros as it takes to make it divisible by 512, with the length of the message in a 64 bit integer appended at the end of the string.
Example:
The word "Hello" in binary is:
01001000 01100101 01101100 01101100 01101111 (H) (e) (l) (l) (o)
Add 1 to the end:
= 01001000011001010110110001101100011011111
Since hello is less than 448 we add 0’s until the string is 448 bits long:
= 01001000011001010110110001101100011011111000…0 (len = 448 bits)
Lastly take the length of the string before processing (40 bits in this case) append that as a 64 bit integer
= ...0000101000 (length of added bits = 64)
So total length is 512 in this example
010010000110010101101100011011000110111110………0101000