Slide 1

Slide 1 text

Hashing. Pascal Hertleif. 9.1.12 Hashing Pascal Hertleif 9. Januar 2012, Uni Bonn 1

Slide 2

Slide 2 text

Hashing. Pascal Hertleif. 9.1.12 GLIEDERUNG Was machen Hash-Algorithmen? Sicheres Hashing • Beispiele: MD5 und SHA-1 • Kollisionssicherheit Hashtabellen 2

Slide 3

Slide 3 text

Hashing. Pascal Hertleif. 9.1.12 Hash- Algorithmen DIE IDEE DER 3

Slide 4

Slide 4 text

Hashing. Pascal Hertleif. 9.1.12 WAS ES MACHT 4 Eingabe (binär) Hash-Wert mit fester Länge Verarbeitung durch Algorithmus

Slide 5

Slide 5 text

Hashing. Pascal Hertleif. 9.1.12 MATHEMATISCH 5 ƒ: {0,1}*→{0,1}k

Slide 6

Slide 6 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #1 EINSTELLIGE QUERSUMME einfacher Hash-Algorithmus: 6

Slide 7

Slide 7 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #1 7 138 3 1+3+8 = 12 ↪ 1+2 = 3

Slide 8

Slide 8 text

Hashing. Pascal Hertleif. 9.1.12 Sicheres Hashing AUS DER KRYPTOGRAPHIE 8

Slide 9

Slide 9 text

Hashing. Pascal Hertleif. 9.1.12 ZIEL: ALGORITHMUS MIT ƒ(x) = ƒ(y) 㱺 x = y 9 Mathematisch ist das für Hash- Algorithmen Unfug.

Slide 10

Slide 10 text

Hashing. Pascal Hertleif. 9.1.12 INFORMATIK: Kollisionen vermeiden! k so groß wählen, dass »in der Praxis« für jede Eingabe ein einmaliger Hash-Wert entsteht. Lösung & Herausforderung! 10

Slide 11

Slide 11 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #2 MD5 message digest v5 11 1991, RONALD L. RIVEST 128 bit (32 Hex-Zeichen)

Slide 12

Slide 12 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #2 MD5 12 md5(“haustier”) = 38fdc332005a584c6d44606dbc1a5429 md5(“Haustier”) = 44fc474b6932895b665550de30e75d5c

Slide 13

Slide 13 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #2 MD5 13 md5 des Open Office 3.3 Installer (Mac): 03b6704231b0c76195d0be3c61ffc847

Slide 14

Slide 14 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #3 SHA-1 secure hashing algorithm v1 14 1994/5, NSA 160 bit (40 in Hex)

Slide 15

Slide 15 text

Hashing. Pascal Hertleif. 9.1.12 Beispiel #3 SHA-1 15 sha1(“haustier”) = 8d4a2c54d25517665a942afb6994b4bb5d12f114 Prüfsumme eines zufälligen Git-Diffs: ef6f41f0eb2c9d539b11006fb0b7442035f9c233

Slide 16

Slide 16 text

Hashing. Pascal Hertleif. 9.1.12 Kollisions- sicherheit FINDE B≠A MIT HASH(A)=HASH(B) 16

Slide 17

Slide 17 text

Hashing. Pascal Hertleif. 9.1.12 NICHT KOLLISIONSSICHER MD5 • 2004: Kollisionen gefunden von Shandong Universität • heute mit einer Grafikkarte und 30 Minuten Zeit reproduzierbar, vgl. md5cracker.org 17

Slide 18

Slide 18 text

Hashing. Pascal Hertleif. 9.1.12 NICHT KOLLISIONSSICHER SHA-1 • 2005, ebenfalls Shandong Universität: Aufwand, Kollisionen zu finden, bei 263 (statt 280) Berechnungen • Ausschreibung der NSA für SHA-3 18

Slide 19

Slide 19 text

Hashing. Pascal Hertleif. 9.1.12 Anwendung Passwörter speichern wichtige Anwendung von Hashing: 19

Slide 20

Slide 20 text

Hashing. Pascal Hertleif. 9.1.12 SALTING Regenbogen-Tabellen: • Array: Hash-Werte und passende Ursprungstexte Salting: • zufälliger Text (Salt) • Speichere: Salt, hash(Passwort+Salt) 20

Slide 21

Slide 21 text

Hashing. Pascal Hertleif. 9.1.12 HASH TABELLEN DATENSTRUKTUREN 21

Slide 22

Slide 22 text

Hashing. Pascal Hertleif. 9.1.12 HASH TABLES Hashwerte als Tabellen-Index (spezielle Hash-Funktion) Schneller Zugriff (im ∅) durch fast direkte Adressierung • Hashwert von gesuchtem Schlüssel = Adresse Zu beachten: Kollisionsbehandlung 22

Slide 23

Slide 23 text

Hashing. Pascal Hertleif. 9.1.12 AUFBAU 23 Abb. 1, frei nach Wiki Commons, 2009, siehe Quellen hash function keys John Smith Lisa Smith Sandra Dee buckets 00 01 521-8976 02 521-1234 03 : : 13 14 521-9655 15

Slide 24

Slide 24 text

Hashing. Pascal Hertleif. 9.1.12 KOLLISIONSBEHANDLUNG • lineares Sondieren (Doppelung auf nächsten Index) • doppeltes Hashen (zweite Hash-Funktion) • Verkettung 24

Slide 25

Slide 25 text

Hashing. Pascal Hertleif. 9.1.12 VERKETTUNG IM KOLLISIONSFALL 25 Abb. 2, frei nach Wiki Commons, 2009, siehe Quellen keys John Smith Lisa Smith Sam Doe Sandra Dee Ted Baker buckets 000 001 002 : : 151 152 153 154 : : 253 254 255 entries Lisa Smith 521-8976 John Smith 521-1234 Sandra Dee 521-9655 Ted Baker 418-4165 Sam Doe 521-5030

Slide 26

Slide 26 text

Hashing. Pascal Hertleif. 9.1.12 HASHTABELLEN ÜBERBLICK + wenig Speicherverbrauch + Avarage Case: O(1) – Worst Case: O(n) (n: Anzahl der Einträge) – Kollisionen, Überfüllung (Entartung) 26

Slide 27

Slide 27 text

Hashing. Pascal Hertleif. 9.1.12 RÜCKBLICK Bitte behalten: 27 Eingabe (binär) Hash-Wert mit fester Länge Hash-Algorithmus

Slide 28

Slide 28 text

Hashing. Pascal Hertleif. 9.1.12 eigene Beispiele! Quellen PROF. DR. CHRISTIAN SCHINDELHAUER: Taschenbuch der Algorithmen. eXamen.press. 2008. T.H. CORMEN, C.E. LEISERSON, R.L. RIVEST: Introduction to Algorithms. The MIT Press. 2001. Abbildungen von Wiki Commons, zu finden auf http:// en.wikipedia.org/wiki/Hash_table, 8.1.12 16:40 28

Slide 29

Slide 29 text

Hashing. Pascal Hertleif. 9.1.12 HABEN SIE FRAGEN? DANKE FÜR IHRE AUFMERKSAMKEIT 29 [email protected]