1 / 9

Hash Functions

Hash Functions . A hash function takes data of arbitrary size and returns a value in a fixed range. If you compute the hash of the same data at different times, you should get the same answer – if not then the data has been modified. Properties of a hash function.

wilda
Download Presentation

Hash Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hash Functions • A hash function takes data of arbitrary size and returns a value in a fixed range. • If you compute the hash of the same data at different times, you should get the same answer – if not then the data has been modified.

  2. Properties of a hash function A hash function h acts on data x and returns a value h(x). The hash function should have these 4 essential properties: • Given x it should be easy to compute h(x). • The input x can be of arbitrary length. • Given a value y, it should be hard to find an x such that h(x) = y. • It is hard to find two different inputs x1and x2such that h(x1) = h(x2).

  3. Why are these important? • To make computations fast and efficient. • So that any message can be hashed. • To prevent a message being replaced with another with the same hash value. • To prevent the sender claiming to have sent x2 when in fact the message was x1.

  4. The Secure Hash Algorithm SHA-1 • Arbitrary length input is divided into blocks of 512 bits. The last block is padded to make 448 bits and the rest of the block is used to give the length of the input before padding. • Each 512 bit block is split into 16 32-bit words denoted by w(0), w(1),….,w(15). • These are expanded into 80 words w(0),…,w(79)

  5. Initially 5 32-bit words h0,….,h4 are given particular values. • For each 512-bit block, SHA-1 operates on w(0),…..,w(79) and h0,….,h4 using shifts, bitstring operations (and, or) and modular arithmetic mod 232 to produce new values of h0,….,h4. • These new value of h0,….,h4 form the initial data for the next block which is expanded and operated on as above to produce the next values of h0,….,h4.

  6. This process of generating new values of h0,….,h4 continues until all of the 512 bit blocks has been processed. • The final set of values h0,….,h4 are then concatenated to form a 160 bit value which is the output of the hash function.

  7. SHA-1 and digital signatures • Instead of sending and signing a message m, Bob can hash m to get SHA(m) and then encrypt SHA(m) using his private key to get a signature s. • Bob then sends the pair (m,s) to Alice. • On receiving the message, Alice • decrypts s using Bob’s public key • hashes m to get SHA(m) • If these two values are the same then the message is authenticated.

  8. SHA-1 and CertificatesX.509 Standard • Bob generates a document containing his relevant information and presents himself with this document to the CA. • The CA confirm Bob’s identity. • The CA hash the document using SHA-1 and encrypt it using their own private key. • This is the certificate.

  9. If Alice wants to communicate with Bob she looks up his public key document and certificate. • She will use the public key of the CA to decrypt the certificate. • She will hash the document using SHA-1 • If these two items are the same then she knows that she can safely communicate with Bob using the public key since the CA has verified his identity.

More Related