Information and Computer Security CPIS 312 Lab 9

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 5: Cryptographic Hashes
Lecture 7 Overview. Advanced Encryption Standard 10, 12, 14 rounds for 128, 192, 256 bit keys – Regular Rounds (9, 11, 13) – Final Round is different.
Copyright © 2005 David M. Wheeler, All Rights Reserved Desert Code Camp: Introduction to Cryptography David M. Wheeler May 6 th 2006 Phoenix, Arizona.
Digital Signatures and Hash Functions. Digital Signatures.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
Dr Alejandra Flores-Mosri Message Authentication Internet Management & Security 06 Learning outcomes At the end of this session, you should be able to:
Chapter 4  Hash Functions 1 Overview  Cryptographic hash functions are functions that: o Map an arbitrary-length (but finite) input to a fixed-size output.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
1 Information System Security AABFS-Jordan Summer 2006 Digital Signature and Hashing Functions Prepared by: Maher Abu Hamdeh & Adel Hamdan Supervised by:
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
CS526Topic 5: Hash Functions and Message Authentication 1 Computer Security CS 526 Topic 5 Cryptography: Cryptographic Hash Functions And Message Authentication.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
CRYPTOGRAPHIC DATA INTEGRITY ALGORITHMS
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Csci5233 Computer Security1 GS: Chapter 6 Using Java Cryptography for Authentication.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
EE515/IS523 Think Like an Adversary Lecture 4 Crypto in a Nutshell Yongdae Kim.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
1 Hashes and Message Digests. 2 Hash Also known as –Message digest –One-way function Function: input message -> output One-way: d=h(m), but not h’(d)
Theory of Computation II Topic presented by: Alberto Aguilar Gonzalez.
CSCI 172/283 Fall 2010 Hash Functions, HMACs, and Digital Signatures.
Cryptographic Hash Functions and Protocol Analysis
Lecture 2: Introduction to Cryptography
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
CS426Fall 2010/Lecture 51 Computer Security CS 426 Lecture 5 Cryptography: Cryptographic Hash Function.
Hashes Lesson Introduction ●The birthday paradox and length of hash ●Secure hash function ●HMAC.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
LAB#6 MAC & MASSAGE DIGEST CPIT 425. Message Authentication 2  Message authentication is a mechanism used to verify the integrity of a message.  Message.
1 Message Authentication using Message Digests and the MD5 Algorithm Message authentication is important where undetected manipulation of messages can.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
LAB#4 PROGRAMMING USING JAVA CRYPTOGRAPHIC LIBRARIES CPIT 425.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Hashing (Message Digest) Hello There Hashing (Message Digest)
Chapter 12 – Hash Algorithms
Java Assignment Related
Lab#7 Digital signature Cpit 425
CHAPTER 4 TJADEN plus Chapters 13 & 14 Crytography Decrypted Hashing Functions, Message Digests, Message Authentication Codes (MACs) Dr. Suzanne Buchele.
Cryptographic Hash Functions & Digital Signatures
Cryptographic Hash Functions
Cryptographic Hash Function
CSCE 715: Network Systems Security
One-way Encryption Ideal Properties
Introduction to security goals and usage of cryptographic algorithms
Cryptographic Hash Functions
Presented by: Dr. Munam Ali Shah
One-way Encryption Properties
NET 311 Information Security
Cryptography Lecture 13.
MAC: Message Authentication Code
Cryptographic Hash Functions
ICS 454 Principles of Cryptography
Introduction to Symmetric-key and Public-key Cryptography
Cryptography: Basics (2)
ICS 454 Principles of Cryptography
Chapter -7 CRYPTOGRAPHIC HASH FUNCTIONS
Lecture 4.1: Hash Functions, and Message Authentication Codes
Chapter 3 - Public-Key Cryptography & Authentication
Cryptography Lecture 14.
Hashing Hash are the auxiliary values that are used in cryptography.
Cryptography Lecture 13.
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
One-way Hash Function Network Security.
Chapter 8 roadmap 8.1 What is network security?
Presentation transcript:

Information and Computer Security CPIS 312 Lab 9 MAC & HASH FUNCTION TRIGUI Mohamed Salim

Lab Objectives To know what hashing is for Practice how to implement MD cipher

What is a Hash Function Cryptographic hash function is another type of cryptographic algorithm. A (one-way) hash function takes variable length input and produces a fixed length output called hash value. Also known as “message digest” or digest. The hash function ensures that if the information has changed, an entirely different output value will be produced.

What is a Hash Function Hash Function maps any message of any length, to an element in a different set. 2 different messages could map to the same value Uses of hash functions are with digital signatures and for data integrity.

Common hash algorithms

Technical Definition of MDAs Message Message digest algorithms take a message of arbitrary size and create a digest of fixed size. The algorithm takes the message and splits it into blocks of equal length (the block size of the algorithm) The last block is padded, with a total message length attached Each block is sent through the function in order. After all blocks are processed, the fixed digest value is retrieved <264 … Block 0 Block 1 Block 2 Block n H(x) In practice, the algorithm has some practical limit on the message size (SHA is limited to 2^64 bits) We are all familiar with Hash Tables from data structures? Or a Hash Map? Digest Value

Message authentication code MAC MAC is an algorithm that requires the use of a secret key. MAC takes a variable-length message and a secret key as input and produces an authentication code. Typically, MAC are used between two parties, say Alice and Bob, that share a secret key K in order to validate information transmitted between these parties. When Alice has a message to send to Bob, she calculates the MAC as a function of the message and the key: MAC = C(K, M) where M=input message, C=MAC function, K=shared secret key.

Message authentication code MAC

Technical Definition of SHA-1 Standardized secure hash function that uses an input message and secret to compute a message authentication Code (MAC). Algorithm characteristics: nonreversible, collision resistant, avalanche effect (slight change in the input will cause a significant change in the MAC output. Highly secure and easy to implement In practice, the algorithm has some practical limit on the message size (SHA is limited to 2^64 bits) We are all familiar with Hash Tables from data structures? Or a Hash Map?

Message authentication code MAC Alice sends to Bob a document as well as a MAC. Bob can authenticate who sent the document by performing the same MAC on the document and comparing his MAC to the one that Alice sent. If they match, he knows that Alice sent the document. diamond icon represents a comparison process

MAC in JAVA Java Package: javax.crypto Java Class : Mac Methods: getInstance(), init(), update(), doFinal(). Algorithms: HMAC (Hashed MAC)

MD in JAVA Java package: java.security Java class: MessageDigest Methods: getInstance(), reset(), update(), digest(). Algorithms: MD5, SHA, SHA-1

MD in JAVA MessageDigest Class: A MessageDigest object starts out initialized. The data is processed through it using the update methods. Once all the data to be updated has been updated, one of the digest methods should be called once to complete the hash computation. After digest has been called, the MessageDigest object is reset to its initialized state. Ex: MessageDigest test = MessageDigest.getInstance("SHA-1"); test.update(data1); // data1 is a byte array that holds the original massage byte[] msgDigest = test.digest(); test.reset(); test.update(data2); ....

MD in JAVA Alternative classes for computing a message digest on a file: DigestInputStream and DigestOutputStream Java pakage: java.security DigestInputStream class: To complete the message digest computation, call one of read methods. Then call one of the digest methods on the associated message digest . int read(): Reads a byte, and updates the message digest and then return an integer value of the byte that it read. Ex: FileInputStream in = new FileInputStream("MD.txt"); MessageDigest md = MessageDigest.getInstance("MD5"); DigestInputStream digestIn = new DigestInputStream(in, md);

MD in JAVA Ex: Java pakage: java.security DigestOutputStream To complete the message digest computation, call one of the digest methods on the associated message digest after that call one of the write methods. void write(byte[] b) : Updates the message digest using the specified array, and in any case writes the array to the output stream. Ex: MessageDigest md = MessageDigest.getInstance("MD5"); FileOutputStream out = new FileOutputStream("MDout.txt"); DigestOutputStream dout = new DigestOutputStream(out, md);