hash functions md5

Upload: john-gregory

Post on 10-Apr-2018

253 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Hash Functions Md5

    1/170

  • 8/8/2019 Hash Functions Md5

    2/170

    What is a

    hash?

  • 8/8/2019 Hash Functions Md5

    3/170

    First, Consider Humpty

    Dumpty...

  • 8/8/2019 Hash Functions Md5

    4/170

    Humpty Dumpty sat on a wall.

  • 8/8/2019 Hash Functions Md5

    5/170

    Humpty Dumpty had a great fall.

  • 8/8/2019 Hash Functions Md5

    6/170

    All the kings horses and all the kings men

  • 8/8/2019 Hash Functions Md5

    7/170

    Couldnt put Humpty together again.

  • 8/8/2019 Hash Functions Md5

    8/170

  • 8/8/2019 Hash Functions Md5

    9/170

    X

  • 8/8/2019 Hash Functions Md5

    10/170

  • 8/8/2019 Hash Functions Md5

    11/170

    h(x)

  • 8/8/2019 Hash Functions Md5

    12/170

    BUTh(x) is a one way function

  • 8/8/2019 Hash Functions Md5

    13/170

    ... so they cant put Humpty together again.

  • 8/8/2019 Hash Functions Md5

    14/170

    x h(x)hash function

    Humpty falls

  • 8/8/2019 Hash Functions Md5

    15/170

    x h(x)hash function

    Humpty falls

    hello MD5

  • 8/8/2019 Hash Functions Md5

    16/170

    x h(x)hash function

    Humpty falls

    hello MD5 5d41402abc4b2a76b9719d911017c592

  • 8/8/2019 Hash Functions Md5

    17/170

    - going backwards -

    -goingbackwards-

  • 8/8/2019 Hash Functions Md5

    18/170

    - going backwards -

    -goingbackwards-

  • 8/8/2019 Hash Functions Md5

    19/170

    - going backwards -

    -goingbackwards-

    NO!!!

  • 8/8/2019 Hash Functions Md5

    20/170

    - going backwards -

    -goingbackwards-

    5d41402abc4b2a76b9719d91

    1017c592

  • 8/8/2019 Hash Functions Md5

    21/170

    - going backwards -

    -goingbackwards-

    5d41402abc4b2a76b9719d91

    1017c592hello

  • 8/8/2019 Hash Functions Md5

    22/170

    Requirements

    h(x)

  • 8/8/2019 Hash Functions Md5

    23/170

    Requirements

    h(x)

    Given h(x)cannot find x

    1

  • 8/8/2019 Hash Functions Md5

    24/170

  • 8/8/2019 Hash Functions Md5

    25/170

    Requirements

    h(x)

    Given h(x)cannot find x

    1

    h(x) isconstant

    2

    Cant find x2so h(x2)=h(x1)

    3

  • 8/8/2019 Hash Functions Md5

    26/170

    Requirement #3 -Humpty Dumpty Style

  • 8/8/2019 Hash Functions Md5

    27/170

    Requirement #3 -Humpty Dumpty Style

  • 8/8/2019 Hash Functions Md5

    28/170

    Requirement #3 -Humpty Dumpty Style

    .........

  • 8/8/2019 Hash Functions Md5

    29/170

    so how does it

    work?

  • 8/8/2019 Hash Functions Md5

    30/170

    hello

  • 8/8/2019 Hash Functions Md5

    31/170

    5d41402abc4b2a76b9719d911017c592

  • 8/8/2019 Hash Functions Md5

    32/170

    were going to focus on MD5

  • 8/8/2019 Hash Functions Md5

    33/170

    1 C t t bi

  • 8/8/2019 Hash Functions Md5

    34/170

    1. Convert x to binary

  • 8/8/2019 Hash Functions Md5

    35/170

    1 Convert x to binary

  • 8/8/2019 Hash Functions Md5

    36/170

    1. Convert x to binary

    2. Pad x so that size ofx (mod 512) = 0

  • 8/8/2019 Hash Functions Md5

    37/170

    0110100001100101011011000110110001101111

    1

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    00000

    0000000000101000

    hello in binary

  • 8/8/2019 Hash Functions Md5

    38/170

  • 8/8/2019 Hash Functions Md5

    39/170

    0110100001100101011011000110110001101111

    1

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    00000

    0000000000101000

    hello in binary

    add 1

    0s untilx mod 512 = 496

  • 8/8/2019 Hash Functions Md5

    40/170

    0110100001100101011011000110110001101111

    1

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 0000000000

    00000

    0000000000101000

    hello in binary

    add 1

    0s untilx mod 512 = 496

    add 16 bit binaryrepresentation of x

  • 8/8/2019 Hash Functions Md5

    41/170

    xpadded =0110100001100101011011000110110001101111 1 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 000000000000000101000

    1 Convert x to binary

  • 8/8/2019 Hash Functions Md5

    42/170

    1. Convert x to binary

    2. Pad x so that size ofx (mod 512) = 0

    3. Break x into 512 bit sub parts and 32 bitwords

  • 8/8/2019 Hash Functions Md5

    43/170

    01101000011001010110110001101100

    0110100001100101011011000110110001101111 1 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 0000000000

    0000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000000000000000000 0000000000 0000000000 0000000000 00000

    0000000000101000

    W1 =

    1 Convert x to binary

  • 8/8/2019 Hash Functions Md5

    44/170

    1. Convert x to binary

    2. Pad x so that size ofx (mod 512) = 0

    3. Break x into 512 bit sub parts and 32 bitwords

    4. Assign values to k[i], r[i], w[g], h0, h1, h2 and h3.

  • 8/8/2019 Hash Functions Md5

    45/170

    k[i] = |sin(i+1)| x 232 where i is in radians

  • 8/8/2019 Hash Functions Md5

    46/170

    k[i] = |sin(i+1)| x 232 where i is in radians

    r[i] = Various round shift amounts

  • 8/8/2019 Hash Functions Md5

    47/170

    k[i] = |sin(i+1)| x 232 where i is in radians

    r[i] = Various round shift amounts

    w[g] = Word number (0 15)

  • 8/8/2019 Hash Functions Md5

    48/170

    k[i] = |sin(i+1)| x 232 where i is in radians

    r[i] = Various round shift amounts

    w[g] = Word number (0 15)

    h0 = a = 0x67452301h1 = b = 0xEFCDAB89h2 = c = 0x98BADCFEh3 = d = 0x10325476

    1. Convert x to binary

  • 8/8/2019 Hash Functions Md5

    49/170

    1. Convert x to binary

    2. Pad x so that size ofx (mod 512) = 0

    3. Break x into 512 bit sub parts and 32 bitwords

    4. Assign values to k[i], r[i], w[g], h0, h1, h2 and h3.5. Perform 64 rounds on each sub part

  • 8/8/2019 Hash Functions Md5

    50/170

  • 8/8/2019 Hash Functions Md5

    51/170

  • 8/8/2019 Hash Functions Md5

    52/170

  • 8/8/2019 Hash Functions Md5

    53/170

  • 8/8/2019 Hash Functions Md5

    54/170

    (AKA AND)

  • 8/8/2019 Hash Functions Md5

    55/170

    p q

    T T

  • 8/8/2019 Hash Functions Md5

    56/170

    p q

    T T T

  • 8/8/2019 Hash Functions Md5

    57/170

    p q

    T T TT F

  • 8/8/2019 Hash Functions Md5

    58/170

    p q

    T T TT F F

  • 8/8/2019 Hash Functions Md5

    59/170

    p q

    T T TT F F

    F T

  • 8/8/2019 Hash Functions Md5

    60/170

    p q

    T T TT F F

    F T F

  • 8/8/2019 Hash Functions Md5

    61/170

    p q

    T T TT F F

    F T F

    F F

  • 8/8/2019 Hash Functions Md5

    62/170

    p q

    T T TT F F

    F T F

    F F F

  • 8/8/2019 Hash Functions Md5

    63/170

    In binary:

    T = 1F = 0

  • 8/8/2019 Hash Functions Md5

    64/170

    p q

    T T TT F F

    F T F

    F F F

  • 8/8/2019 Hash Functions Md5

    65/170

    p q

    T T TT F F

    F T F

    F F F

    bit 1 bit 2

    1 1 11 0 0

    0 1 0

    0 0 0

  • 8/8/2019 Hash Functions Md5

    66/170

  • 8/8/2019 Hash Functions Md5

    67/170

  • 8/8/2019 Hash Functions Md5

    68/170

    bit 1 bit 2

    1 1 11 0 1

    0 1 1

    0 0 0

  • 8/8/2019 Hash Functions Md5

    69/170

    XOR is a type of logical disjunction on two operands that resultsin a value of true if and only if exactly one of the operands has a

    value of true

  • 8/8/2019 Hash Functions Md5

    70/170

    bit 1 bit 2

    1 1 11 0 1

    0 1 1

    0 0 0

    bit 1 bit 2

    1 1 F1 0 T

    0 1 T

    0 0 F

  • 8/8/2019 Hash Functions Md5

    71/170

  • 8/8/2019 Hash Functions Md5

    72/170

    (not)

  • 8/8/2019 Hash Functions Md5

    73/170

    1=00=1

  • 8/8/2019 Hash Functions Md5

    74/170

  • 8/8/2019 Hash Functions Md5

    75/170

    1 0 1 0 1 0

  • 8/8/2019 Hash Functions Md5

    76/170

    0 1 0 1 0 0

    0 1 0 1 0

    0

  • 8/8/2019 Hash Functions Md5

    77/170

  • 8/8/2019 Hash Functions Md5

    78/170

    Remember:a,b,c,d are h0-3

  • 8/8/2019 Hash Functions Md5

    79/170

    Operation A

    f = (b c) ( b d)g = i

  • 8/8/2019 Hash Functions Md5

    80/170

  • 8/8/2019 Hash Functions Md5

    81/170

  • 8/8/2019 Hash Functions Md5

    82/170

    Operation D

    f = c

    (b

    ( d))g = (7i) mod 16

  • 8/8/2019 Hash Functions Md5

    83/170

  • 8/8/2019 Hash Functions Md5

    84/170

    A B C D

  • 8/8/2019 Hash Functions Md5

    85/170

    A B C D

  • 8/8/2019 Hash Functions Md5

    86/170

    A B C D

  • 8/8/2019 Hash Functions Md5

    87/170

    B

    b + {(a + f + k[i] + w[g])

  • 8/8/2019 Hash Functions Md5

    88/170

    b + {(a + f + k[i] + w[g])

  • 8/8/2019 Hash Functions Md5

    89/170

    After all 64 rounds...

    1. Convert x to binary

    2 P d th t i f ( d 512) 0

  • 8/8/2019 Hash Functions Md5

    90/170

    2. Pad x so that size ofx (mod 512) = 0

    3. Break x into 512 bit sub parts and 32 bitwords

    4. Assign values to k[i], r[i], w[g], h0, h1, h2 and h3.5. Perform 64 rounds on each sub part6. Add a, b, c and d to register values

  • 8/8/2019 Hash Functions Md5

    91/170

    1. Convert x to binary

    2 P d th t i f (mod 512) 0

  • 8/8/2019 Hash Functions Md5

    92/170

    2. Pad x so that size ofx (mod 512) = 0

    3. Break x into 512 bit sub parts and 32 bitwords

    4. Assign values to k[i], r[i], w[g], h0, h1, h2 and h3.5. Perform 64 rounds on each sub part6. Add a, b, c and d to register values

    7. Append the register values to create digest

  • 8/8/2019 Hash Functions Md5

    93/170

    128 bit digest

  • 8/8/2019 Hash Functions Md5

    94/170

    hello

  • 8/8/2019 Hash Functions Md5

    95/170

    5d41402abc4b2a76b9719d911017c592

  • 8/8/2019 Hash Functions Md5

    96/170

    So?

  • 8/8/2019 Hash Functions Md5

    97/170

    Applications

  • 8/8/2019 Hash Functions Md5

    98/170

    Applications

    PasswordProtection

    MessageI i

  • 8/8/2019 Hash Functions Md5

    99/170

    Applications

    PasswordProtection

    Integrity

    MessageI i

  • 8/8/2019 Hash Functions Md5

    100/170

    Applications

    PasswordProtection

    Integrity

    DigitalSignatures

  • 8/8/2019 Hash Functions Md5

    101/170

    Password Protection

  • 8/8/2019 Hash Functions Md5

    102/170

    When you registered...

  • 8/8/2019 Hash Functions Md5

    103/170

    passwordMD5

    5f4dcc3b5aa765d61d8327deb882cf99

    When you registered...

  • 8/8/2019 Hash Functions Md5

    104/170

    passwordMD5

    5f4dcc3b5aa765d61d8327deb882cf99

    Data Base

  • 8/8/2019 Hash Functions Md5

    105/170

  • 8/8/2019 Hash Functions Md5

    106/170

    password

  • 8/8/2019 Hash Functions Md5

    107/170

    password

    MD5

  • 8/8/2019 Hash Functions Md5

    108/170

    password

    MD5

    5f4dcc3b5aa765d61d8327deb882cf99

    5f4dcc3b5aa765d61d8327deb882cf99

  • 8/8/2019 Hash Functions Md5

    109/170

    =

    stored, hashed password?

    5f4dcc3b5aa765d61d8327deb882cf99

  • 8/8/2019 Hash Functions Md5

    110/170

    =

    stored, hashed password?

    No.

    Give incorrectpassword error

    5f4dcc3b5aa765d61d8327deb882cf99

  • 8/8/2019 Hash Functions Md5

    111/170

    =

    stored, hashed password?

    No.

    Give incorrectpassword error

    Yes.

    Let userinto website

  • 8/8/2019 Hash Functions Md5

    112/170

  • 8/8/2019 Hash Functions Md5

    113/170

  • 8/8/2019 Hash Functions Md5

    114/170

    Attacks

  • 8/8/2019 Hash Functions Md5

    115/170

    RainbowTables

  • 8/8/2019 Hash Functions Md5

    116/170

  • 8/8/2019 Hash Functions Md5

    117/170

    omgyouarenevergoingtocrackthis123

    1c9fee8bd70a5afb630fc4f38e97123f

  • 8/8/2019 Hash Functions Md5

    118/170

    omgyouarenevergoingtocrackthis123

    1c9fee8bd70a5afb630fc4f38e97123f

  • 8/8/2019 Hash Functions Md5

    119/170

    and Brute Force

    Attacks

  • 8/8/2019 Hash Functions Md5

    120/170

  • 8/8/2019 Hash Functions Md5

    121/170

  • 8/8/2019 Hash Functions Md5

    122/170

    File

  • 8/8/2019 Hash Functions Md5

    123/170

    Verification

    File

  • 8/8/2019 Hash Functions Md5

    124/170

    Verification

    Guarding againstcorruption

    File

  • 8/8/2019 Hash Functions Md5

    125/170

    Verification

    Guarding againstcorruption

    Proving you

    have somethingbefore yourelease it

  • 8/8/2019 Hash Functions Md5

    126/170

    Attacks

  • 8/8/2019 Hash Functions Md5

    127/170

    Nostradamus Attack

  • 8/8/2019 Hash Functions Md5

    128/170

  • 8/8/2019 Hash Functions Md5

    129/170

    But on November 30th 2007...

  • 8/8/2019 Hash Functions Md5

    130/170

    We have used a Sony Playstation 3 to correctly predict theoutcome of the 2008 US presidential elections. In order not toinfluence the voters we keep our prediction secret, but commit to it

    by publishing its cryptographic hash on this website. The

    document with the correct prediction and matching hash will berevealed after the elections.

    - Marc Stevens, Arjen Lenstra and Benne de Weger

  • 8/8/2019 Hash Functions Md5

    131/170

    3D515DEAD7AA16560ABA3E9DF05CBC80

  • 8/8/2019 Hash Functions Md5

    132/170

    But how could they have known!?!?

  • 8/8/2019 Hash Functions Md5

    133/170

    But how could they have known!?!?They didnt.

  • 8/8/2019 Hash Functions Md5

    134/170

    3D515DEAD7AA16560ABA3E9DF05CBC80

  • 8/8/2019 Hash Functions Md5

    135/170

    Digital Signatures

  • 8/8/2019 Hash Functions Md5

    136/170

    MD5

    hash

  • 8/8/2019 Hash Functions Md5

    137/170

    hash

    MD5

  • 8/8/2019 Hash Functions Md5

    138/170

    privatekey

    encrypted

    hash

    MD5

  • 8/8/2019 Hash Functions Md5

    139/170

    privatekey

    encryptedpublic

    key

    hash

    hash

    MD5

  • 8/8/2019 Hash Functions Md5

    140/170

    privatekey

    encryptedpublic

    key

    hash

    MD5

    hash

    MD5

  • 8/8/2019 Hash Functions Md5

    141/170

    privatekey

    encryptedpublic

    key

    hash

    MD5

  • 8/8/2019 Hash Functions Md5

    142/170

    Attacks

  • 8/8/2019 Hash Functions Md5

    143/170

    Collision Attack

  • 8/8/2019 Hash Functions Md5

    144/170

    hashChangedM

  • 8/8/2019 Hash Functions Md5

    145/170

    encryptedpublic

    key

    hash

    Message

    MD5

  • 8/8/2019 Hash Functions Md5

    146/170

    Very Dangerous!

    Bi thd Att k

  • 8/8/2019 Hash Functions Md5

    147/170

    Birthday Attack

  • 8/8/2019 Hash Functions Md5

    148/170

    Relies on Birthday Paradox

  • 8/8/2019 Hash Functions Md5

    149/170

    First we calculate the chanceno one has the same birthday

    y

  • 8/8/2019 Hash Functions Md5

    150/170

    p(1)=100%

  • 8/8/2019 Hash Functions Md5

    151/170

    p(2)=(1)(1 - 1/365)

  • 8/8/2019 Hash Functions Md5

    152/170

    p(3)=(1)(1 - 1/365)(1 - 2/365)

  • 8/8/2019 Hash Functions Md5

    153/170

    To Generalize...

  • 8/8/2019 Hash Functions Md5

    154/170

    365! .365n(365-n)!

    P(n)=

  • 8/8/2019 Hash Functions Md5

    155/170

    23 50% chance

  • 8/8/2019 Hash Functions Md5

    156/170

    30 70.6% chance

  • 8/8/2019 Hash Functions Md5

    157/170

    50 97% chance

  • 8/8/2019 Hash Functions Md5

    158/170

    We can use this property to find

    out how many hashes mustbe calculated to find a collision.

  • 8/8/2019 Hash Functions Md5

    159/170

    Current State of MD5

  • 8/8/2019 Hash Functions Md5

    160/170

    MD5 =

  • 8/8/2019 Hash Functions Md5

    161/170

    MD5 = Broken

  • 8/8/2019 Hash Functions Md5

    162/170

    The Future of Hashes

  • 8/8/2019 Hash Functions Md5

    163/170

  • 8/8/2019 Hash Functions Md5

    164/170

    Submissions were due on October 30th

  • 8/8/2019 Hash Functions Md5

    165/170

    Currently Submitted

    BLAKE

    Keccak

    MaracaMD6Skein

  • 8/8/2019 Hash Functions Md5

    166/170

    Blue Midnight Wish

    Boole

    CubeHashEdon-R

    EnRUPT

    ESSENCE

    Sgil

    Grstl

    Keccak

    MCSSHA-3

    NaSHANKS2D

    PonicSHAMATA

    WaMM

    Waterfall

    BLAKE

    Keccak

    MaracaMD6Skein

  • 8/8/2019 Hash Functions Md5

    167/170

    Blue Midnight Wish

    Boole

    CubeHashEdon-R

    EnRUPT

    ESSENCE

    Sgil

    Grstl

    Keccak

    MCSSHA-3

    NaSHANKS2D

    PonicSHAMATA

    WaMM

    Waterfall

  • 8/8/2019 Hash Functions Md5

    168/170

  • 8/8/2019 Hash Functions Md5

    169/170

    Thank you for coming!

  • 8/8/2019 Hash Functions Md5

    170/170