About Hashes Keys and Ciphers

Contents

  • 1 Hashes
    • 1.1 General
    • 1.2 Different encryptions and lenght
  • 2 Algorithm
    • 2.1 MD5 – Message Digest #5
    • 2.2 SHA-1 – Secure Hash Algorithm
    • 2.3 RIPEMD-160
  • 3 Collisions
  • 4 Encryption Methods
    • 4.1 Symmetric key cryptography
      • 4.1.1 Stream ciphers
      • 4.1.2 Block ciphers
      • 4.1.3 Cipher Block Modes
    • 4.2 Asymmetric key / Public key cryptography
      • 4.2.1 Nachteile
      • 4.2.2 Algorithmen
  • 5 Äquivalente kryptographische Stärken
  • 6 Angriffe welche mit Kryptografie “bekämpft” werden können

Hashes

General

128-bit hash can have 2128 possible values, which is:

340,282,366,920,938,463,463,374,607,431,768,211,456

possible hashes

512-bit can have 2512 possible values, which is:

 13,407,807,929,942,597,099,574,024,998,205,846,127,479,
365,820,592,393,377,723,561,443,721,764,030,073,546,976,
801,874,298,166,903,427,690,031,858,186,486,050,853,753,
882,811,946,569,946,433,649,006,084,096

possible hashes 🙂

Different encryptions and lenght

Parity-Bit    1 Bit
CRC-16       16 Bit
CRC-32       32 Bit
HMAC         96 Bit
MD4         128 Bit   (obsolete) http://en.wikipedia.org/wiki/MD4
MD5         128 Bit   http://en.wikipedia.org/wiki/MD5
RIPEMD-128  128 Bit
RIPEMD160   160 Bit   http://en.wikipedia.org/wiki/RIPEMD-160
SHA1        160 Bit   http://en.wikipedia.org/wiki/SHA
SHA256      256 Bit
SHA384      384 Bit
SHA512      512 Bit

 

Algorithm

MD5 – Message Digest #5

  • Invented by Ron Rivest (the R in RSA) of RSA Security Inc.
  • MD5 computes a hash value of 128 bits (16 bytes) out of an arbitrary-sized binary document.

SHA-1 – Secure Hash Algorithm

  • Developed by the US National Institute of Standards and Technology (NIST) with the assistance of the National Security Agency (NSA).
  • SHA-0 or simply SHA was published in 1993 as FIPS-180 by NIST. Due to a non-disclosed flaw it was withdrawn by NSA shortly after publication. The revised version, commonly referred to as SHA-1 was published in 1995 in the standard FIPS 180-1.
  • SHA-1 computes a hash value of 160 bits (20 bytes) out of an arbitrary-sized binary document. The algorithm is similar to MD5 but is computationally more expensive.
  • SHA-1 is more secure than MD5 due to its increased hash size.
  • An improved family of algorithms with hash sizes of 256 bits (32 bytes), 384 bits (48 bytes) and 512 bits (64 bytes) was published by NIST in the standard FIPS-180-2 in August 2002 in order to keep up with the increased key sizes of the Advanced Encryption Standard (AES). These new hash algorithms are named according to their key sizes SHA-256, SHA-384, and SHA-512, respectively.

RIPEMD-160

  • 160 bit hash function developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel as part of a

research project commissioned by the EU. It’s similar in both strength and performance to the much more popular SHA-1 hash function.

 

 

Collisions

A collision is when two different files produces the same hash-sum.

1
#!/usr/bin/perl -w

use strict;

my $v1=<<END_V1; d1 31 dd 02 c5 e6 ee c4 69 3d 9a 06 98 af f9 5c 2f ca b5 87 12 46 7e ab 40 04 58 3e b8 fb 7f 89 55 ad 34 06 09 f4 b3 02 83 e4 88 83 25 71 41 5a 08 51 25 e8 f7 cd c9 9f d9 1d bd f2 80 37 3c 5b d8 82 3e 31 56 34 8f 5b ae 6d ac d4 36 c9 19 c6 dd 53 e2 b4 87 da 03 fd 02 39 63 06 d2 48 cd a0 e9 9f 33 42 0f 57 7e e8 ce 54 b6 70 80 a8 0d 1e c6 98 21 bc b6 a8 83 93 96 f9 65 2b 6f f7 2a 70 END_V1

my $v2=<<END_V2; d1 31 dd 02 c5 e6 ee c4 69 3d 9a 06 98 af f9 5c 2f ca b5 07 12 46 7e ab 40 04 58 3e b8 fb 7f 89 55 ad 34 06 09 f4 b3 02 83 e4 88 83 25 f1 41 5a 08 51 25 e8 f7 cd c9 9f d9 1d bd 72 80 37 3c 5b d8 82 3e 31 56 34 8f 5b ae 6d ac d4 36 c9 19 c6 dd 53 e2 34 87 da 03 fd 02 39 63 06 d2 48 cd a0 e9 9f 33 42 0f 57 7e e8 ce 54 b6 70 80 28 0d 1e c6 98 21 bc b6 a8 83 93 96 f9 65 ab 6f f7 2a 70 END_V2

my $p=join(“”,map {chr(hex($_))} split /\s+/, $v1); my $q=join(“”,map {chr(hex($_))} split /\s+/, $v2);

print `echo -n \’$p\’|md5sum`; print `echo -n \’$q\’|md5sum`;

Encryption Methods

Symmetric key cryptography

Stream ciphers

Algorithms:
A5/1 | A5/2 | FISH | Grain | ISAAC | MUGI | Panama | Phelix | Pike | RC4 | Salsa20 | Scream | SEAL | SOBER | SOBER-128 | Trivium | VEST | WAKE

Block ciphers

A block cipher is a type of symmetric-key encryption algorithm that transforms a fixed-length block of plaintext (unencrypted text) data into a block of ciphertext (encrypted text) data of the same length. This transformation takes place under the action of a user-provided secret key. Decryption is performed by applying the reverse transformation to the ciphertext block using the same secret key. The fixed length is called the block size, and for many block ciphers, the block size is 64 bits. In the coming years the block size will increase to 128 bits as processors become more sophisticated.

Algorithms:
3-Way | AES | Akelarre | Anubis | Blowfish | Camellia | CAST-128 | CAST-256 | CMEA | CS-Cipher | DEAL | DES | DES-X | FEAL | FOX | FROG | G-DES | GOST | ICE | IDEA | Iraqi | KASUMI | KHAZAD | Khufu and Khafre | LOKI89/91 | LOKI97 | Lucifer | MacGuffin | Madryga | MAGENTA | MARS | MISTY1 | MMB | NewDES | Noekeon | RC2 | RC5 | RC6 | REDOC | Red Pike | S-1 | SAFER | SEED | Serpent | SHACAL | SHARK | Skipjack | Square | TEA | Triple DES | Twofish | XTEA

Cipher Block Modes

  • ECB – Electronic codebook
  • CBC – Cipher-block chaining
CBC verhindert, dass gleiche Dateien nach der Verschlüsselung gleich aussehen – das alte Verfahren ECB sorgt dafür, dass jede verschlüsselte Datei immer wieder gleich aussieht (Stichwort Bijektivität). So kann man leicht erkennen, ob eine bestimmte Datei mehrfach auf der Festplatte liegt. Außerdem kann dies genutzt werden, um z.B. ganze Blöcke zu identifizieren und zu übersetzen, wenn man einige Teile der Festplatte schon kennt, was bei Standardsystemen der Fall ist (z.B. Informationen über das Dateisystem, etc.)
Um dies zu verhindern, nutzt man CBC, das bei der Verschlüsselung auch Informationen von dem vorher verschlüsseltem Sektor mit einfließen lässt. So sieht jeder verschlüsselte Bereich anders aus, und kann nicht reproduziert werden.
  • CFB – Cipher feedback
  • OFB – Output feedback
  • CTR – Counter
  • ESSIV (encrypted sector | salt initial vector)
ESSIV sorgt dafür, dass Watermarking-Angriffe erfolglos bleiben. Bei diesen Angriffen versucht man, mit Hilfe einer speziell präparierten Datei, die man z.B. per Spam-Mail auf einen Rechner senden kann, herauszufinden, ob diese Datei auf der Festplatte liegt, und wenn ja, wo in etwa. Das Wasserzeichen schimmert quasi durch die Verschlüsslung durch, wenn man gezielt danach sucht.
Dies erfordert aber, dass der Initialisierungsvektor recht einfach berechnet werden kann, was ESSIV verhindert. Bei dem alten Verfahren plain können hingegen Watermarking-Angriffe zum Erfolg führen.
ESSIV kann derzeit als Option nur sha256 oder md5 entgegen nehmen – alle anderen implementierungen sind noch nicht in Standardpaketen verfügbar (Stand Juli 2005).

Asymmetric key / Public key cryptography

Der Schlüssel ist in 2 Teile aufgeteilt, einen öffentlichen und einen geheimen. Der geheime Teil des Schlüsselpaares ist nur einer Stelle bekannt. Der Nachteil der symmetrischen Verfahren existiert hier nicht, es braucht nur n , resp. 2n Schlüsselpaare.

Nachteile

Der grösste Nachteil ist der erhöhte Rechenaufwand.

Algorithmen

  • RSA

 

Äquivalente kryptographische Stärken

  Sym.        RSA n    ECC p         Rate der Schlüsselgrössen
  (in Bit)    (in Bit) (in Bit)  Sym : RSA    Sym : ECC   RSA : ECC
     56         512      112     1:9          1:2         5:1
     80        1024      160     1 : 13       1:2         6:1
    112        2048      224     1 : 18       1:2         9:1
    128        3072      256     1 : 24       1:2         12 : 1
    192        7680      384     1 : 40       1:2         20 : 1
    256       15’360     512     1 : 60       1:2         30 : 1

 

Angriffe welche mit Kryptografie “bekämpft” werden können

  • Abhören einer Meldung (Confidentiality) –> symmetrische/ asymmetrische Verschlüsselung
  • Verändern der Meldung (Integrity) –> MAC Berechnung (sym.) / Digitale SIgnatur (asym)
  • Eine erfundene Meldung einspielen (Insertion) –> MAC Berechnung (sym.) / Digitale Signatur (asym)
  • Abstreiten die Meldung geschickt zu haben (Non repudiation of origin) –> Digitale Signatur (asym)
  • Eine Meldung abfangen und später wieder einspielen (Replay) –> MAC und Sequenznummer (sym) / Digitale Signatur und Sequenznummer (asym)
  • Löschen von Meldungen (Delete). –> MAC und Sequenznummer (sym) / Digitale Signatur und Sequenznummer (asym)
  • Sich für jemanden anders ausgeben (Masquerade)
  • Abstreiten die Meldung erhalten zu haben (Non repudiation of receipt).
This entry was posted in Security. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.