Hash Functions and SHA-3 2 Iterated Hash Functions

Total Page:16

File Type:pdf, Size:1020Kb

Hash Functions and SHA-3 2 Iterated Hash Functions Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro 1 Introduction Hash Functions and SHA-3 2 Iterated hash functions Lars R. Knudsen 3 Block cipher constructions 4 SHA-3 February 13, 2008 5 Outtro 1/59 2/59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Definition - hash function Generic attacks For H : {0, 1}∗ →{0, 1}n Aboriginal settlers arrived on the conti- nent from Southeast Asia about 40,000 years before the first Europeans began ex- ploration in the 17th century. No formal attack rough complexities territorial claims were made until 1770, √ when Capt. James Cook took possession n n/2 inthenameofGreatBritain.Sixcolonies - - collisions 2 =2 were created in the late 18th and 19th H 150763210262 n centuries; they federated and became the 2nd preimages 2 Commonwealth of Australia in 1901. The n new country took advantage of its nat- preimage 2 ural resources to rapidly develop agricul- tural and manufacturing industries and to make a major contribution to the British effort in World Wars I and II. Goal: generic attacks are best (known) attacks H : {0, 1}∗ →{0, 1}n, for fixed value of n 3/59 4/59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Further properties Structure “Behave like” a random oracle Classical Merkle-Damg˚ard ? Indifferentiable from random oracle Sponge ? Variants of (seond)-preimage resistance Two chains ? aPre, ePre, aSec, and eSec RIPE-MD style Checksums (MD2) Security against Double-pipe Extension attack Multi-collisions 5/59 6/59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Iterated hash functions - (Merkle-Damg˚ard schemes) Generic attacks - iterated hash functions ∗ n For H : {0, 1} →{0, 1} Message - Padding - x1, x2,...,xt−1, xt attack rough complexities collisions 2n/2 2nd preimages k2n/2 +2n−k with 2k blocks preimage 2n x1 P x2 P xt P - PP - PP - PP PPP PPP PPP - Compress - Compress - - Compress - h0 ··· ht h1 ht−1 7/59 8/59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Merkle (1989) Damg˚ard (1989) h : {0, 1}m →{0, 1}t , assume m > t +1 h : {0, 1}m →{0, 1}t , assume m > t Split message, x,intoblocksofm − t − 1bits. Split message, x,intoblocksofm − t bits. If last block incomplete, pad with d zeros. If last block incomplete, pad with zeros. Append extra block containing bin. repr. of d (fixed length) Append extra block containing length of x (bits) Then define Define hi = h(hi , xi ), +1 +1 h1 = h(iv | 0 | x1) H(x)=hs . hi+1 = h(hi | 1 | xi+1) Collision for H means collision for h H(x)=hs . 10 / 59 13 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Damg˚ard (1989) (2) Merkle-Damg˚ard Strengthening, Lai-Massey (1992) Build H : {0, 1}∗ →{0, 1}n from h : {0, 1}m →{0, 1}n, m > n Merkle’s scheme Parallelizable hash: h : {0, 1}2t →{0, 1}t H : {0, 1}N →{0, 1}n Message x of j bits. j Pad message with 0s until length is 2 t for some j. Damg˚ard’s scheme j Let h0 be padded message of 2 t bits H : {0, 1}∗ →{0, 1}n j−1 Hash h0 to h1 of 2 t bits using h j−2 Lai-Massey used Merkle’s scheme and named the method Hash h1 to h2 of 2 t bits using h Merkle-Damg˚ard Strengthening Gives hj of t bits H(x)=h(hj | length(x)) collision for H ⇒ collision for h NB! Pad with ’1’, then zeros, then add message length (blocks) to message 14 / 59 15 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro In the beginning there was ... Diffie-Hellman, κ>n e : {0, 1}κ ×{0, 1}n →{0, 1}n Diffie and Hellman, 1976. New directions in cryptography. (mi | hi− ) Digital signatures .... for efficiency: 1 “Let g be a one-way mapping from binary N-space to binary n-space...”. “Take the N bit message m and operate on it ? with g to obtain the n bit vector m .” - - x0 e hi “Itmustbehardevengivenm to find a different inverse image of m” x0 fixed block “Finding such functions appears to offer little trouble” 2nd preimages hard if e secure against known-plaintext attack 19 / 59 20 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Hash function using a block cipher Block cipher based hash functions Why build on a block cipher? it’s natural ! “Diffusion is more important than confusion in hash functions” use existing technology “Confusion is more important than diffusion in block ciphers” transfer security (trust?!) to hash construction Why? Why not have S-boxes in hash functions ? How fast should/can a hash function be ? schemes “slow” (partly due to key-schedules) weaknesses of block cipher not relevant for encryption 21 / 59 22 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Speed .. Additive stream cipher k ? - - iv z1, z2, z3, z4,... 23 / 59 24 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Block cipher Hash function k mi ? ? - - pi - - ci hi−1 f hi 25 / 59 26 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Speed .. DES & AES Additive stream cipher, known/chosen plaintext attack DES = Data Encryption Standard Block cipher, chosen plaintext attack AES = Advanced Encryption Standard Hash function, known/chosen-key attack Stream 4-8 cycles/byte system year block size key size AES 20 cycles/byte DES 1977 64 56 SHA-1 11 cycles/byte AES 2001 128 128, 192 or 256 SHA-512 18 cycles/byte 27 / 59 28 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Hash rate Rabin, 1978 e : {0, 1}κ ×{0, 1}n →{0, 1}n Given hash function built from block cipher mi e : {0, 1}κ ×{0, 1}n →{0, 1}n Rate usually is defined as ? # n-bit blocks hashed - - hi− e hi #invocationsofe 1 Ought perhaps be defined as rate = (κ/n)/(1 + 1) # n-bit blocks hashed #invocationsofe + # key-schedules Yuval: collisions based on birthday paradox (79) (Merkle 79) Pre-images in approximately same time 29 / 59 30 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Davies-Price variant of Rabin’s scheme 1980 Single block hash { , }κ ×{ , }n →{ , }n m e : 0 1 0 1 0 1 m1 m2 t−1 mt ↓ ↓ ↓ ↓ h0 −→ e −→ e −→·········−→ e −→ e −→ ht 12 secure ones (Preneel 93, Black et al 02), here three m ⊕ m1 m2 t−1 mt hi = emi (hi−1) hi−1 Davies-Meyer ↓ ↓ ↓ ↓ h −→ e −→ e −→·········−→ e −→ e −→ h ⊕ t 2t hi = ehi−1 (mi ) mi Matyas-Meyer-Oseas ⊕ ⊕ hi = ehi−1 (mi ) mi hi−1 Preneel-Miyaguchi Coppersmith 1985: Hash rates. About 1/(1+1) (1/2 for DES and AES) preimage attack on one-chain Rabin ≈ 2n/2 preimage attack on two-chains Rabin ≈ 2n/2+n/16 using Collisions (birthday attack) in 2n/2 operations multi-collisions 31 / 59 33 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro MD4-family Double block hash - based on block ciphers MD4, Rivest 1990 Based on e : {0, 1}κ ×{0, 1}n →{0, 1}n MD5, Rivest 1991 Length of hash, 2n bits SHA-0, 1993 Aim: 2n security level for collisions SHA-1, 1994 Merkle, 1989 all hash functions of Davies-Meyer form MDC-2, Brachtl, Coppersmith et al 1988/1990 PBGV, QG, LOKI-DBH, ...., 1990s “block ciphers” with feed-forward Hirose, Nandi, 2005 hash rates for Davies-Meyer can be (arbitrarily) high 34 / 59 35 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Merkle’s double block schemes with DES (1989) MDC-2 mi “DES can be used to build a one-way hash function which is q secure” qq ? ? if DES fails “it seems almost certain that some block cipher h1 -φ- e h2 -φ- e exist with the desirable properties” i−1 1 i−1 2 ? ? i i proof of security in ideal cipher model ? ? X A B XX C D 55 XX collisions ≈ 2 , inconvenient block sizes, low hash rates XX XXXz ? 9 ? A D C B “recent proposal from IBM looks very hopeful”, but no proof.. ? ? 1 2 hi hi 36 / 59 37 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro MDC-2 MCD-2 used with DES and AES (Best known attacks) DES AES designed for DES but can be used with any block cipher Preimage attack 283 2192 83 192 hash rate 1/(2+2) (1/4 for DES and AES) 2nd preimage attack 2 2 Collision attack 255 2128 1992: Coppersmith “defends” MDC-2 Hash rate 1/4 1/4 For use with AES, “proof” that collision requries > 275 operations (Steinberger 2007) 38 / 59 39 / 59 Introduction Iterated hash functions Block cipher constructions SHA-3 Outtro Introduction Iterated hash functions Block cipher constructions
Recommended publications
  • FIPS 140-2 Non-Proprietary Security Policy Oracle Linux 7 NSS
    FIPS 140-2 Non-Proprietary Security Policy Oracle Linux 7 NSS Cryptographic Module FIPS 140-2 Level 1 Validation Software Version: R7-4.0.0 Date: January 22nd, 2020 Document Version 2.3 © Oracle Corporation This document may be reproduced whole and intact including the Copyright notice. Title: Oracle Linux 7 NSS Cryptographic Module Security Policy Date: January 22nd, 2020 Author: Oracle Security Evaluations – Global Product Security Contributing Authors: Oracle Linux Engineering Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 oracle.com Copyright © 2020, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. Oracle specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may reproduced or distributed whole and intact including this copyright notice. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Oracle Linux 7 NSS Cryptographic Module Security Policy i TABLE OF CONTENTS Section Title
    [Show full text]
  • Extending NIST's CAVP Testing of Cryptographic Hash Function
    Extending NIST’s CAVP Testing of Cryptographic Hash Function Implementations Nicky Mouha and Christopher Celi National Institute of Standards and Technology, Gaithersburg, MD, USA [email protected],[email protected] Abstract. This paper describes a vulnerability in Apple’s CoreCrypto library, which affects 11 out of the 12 implemented hash functions: every implemented hash function except MD2 (Message Digest 2), as well as several higher-level operations such as the Hash-based Message Authen- tication Code (HMAC) and the Ed25519 signature scheme. The vulnera- bility is present in each of Apple’s CoreCrypto libraries that are currently validated under FIPS 140-2 (Federal Information Processing Standard). For inputs of about 232 bytes (4 GiB) or more, the implementations do not produce the correct output, but instead enter into an infinite loop. The vulnerability shows a limitation in the Cryptographic Algorithm Validation Program (CAVP) of the National Institute of Standards and Technology (NIST), which currently does not perform tests on hash func- tions for inputs larger than 65 535 bits. To overcome this limitation of NIST’s CAVP, we introduce a new test type called the Large Data Test (LDT). The LDT detects vulnerabilities similar to that in CoreCrypto in implementations submitted for validation under FIPS 140-2. Keywords: CVE-2019-8741, FIPS, CAVP, ACVP, Apple, CoreCrypto, hash function, vulnerability. 1 Introduction The security of cryptography in practice relies not only on the resistance of the algorithms against cryptanalytical attacks, but also on the correctness and robustness of their implementations. Software implementations are vulnerable to software faults, also known as bugs.
    [Show full text]
  • A (Second) Preimage Attack on the GOST Hash Function
    A (Second) Preimage Attack on the GOST Hash Function Florian Mendel, Norbert Pramstaller, and Christian Rechberger Institute for Applied Information Processing and Communications (IAIK), Graz University of Technology, Inffeldgasse 16a, A-8010 Graz, Austria [email protected] Abstract. In this article, we analyze the security of the GOST hash function with respect to (second) preimage resistance. The GOST hash function, defined in the Russian standard GOST-R 34.11-94, is an iter- ated hash function producing a 256-bit hash value. As opposed to most commonly used hash functions such as MD5 and SHA-1, the GOST hash function defines, in addition to the common iterated structure, a check- sum computed over all input message blocks. This checksum is then part of the final hash value computation. For this hash function, we show how to construct second preimages and preimages with a complexity of about 2225 compression function evaluations and a memory requirement of about 238 bytes. First, we show how to construct a pseudo-preimage for the compression function of GOST based on its structural properties. Second, this pseudo- preimage attack on the compression function is extended to a (second) preimage attack on the GOST hash function. The extension is possible by combining a multicollision attack and a meet-in-the-middle attack on the checksum. Keywords: cryptanalysis, hash functions, preimage attack 1 Introduction A cryptographic hash function H maps a message M of arbitrary length to a fixed-length hash value h. A cryptographic hash function has to fulfill the following security requirements: – Collision resistance: it is practically infeasible to find two messages M and M ∗, with M ∗ 6= M, such that H(M) = H(M ∗).
    [Show full text]
  • Advanced Meet-In-The-Middle Preimage Attacks: First Results on Full Tiger, and Improved Results on MD4 and SHA-2
    Advanced Meet-in-the-Middle Preimage Attacks: First Results on Full Tiger, and Improved Results on MD4 and SHA-2 Jian Guo1, San Ling1, Christian Rechberger2, and Huaxiong Wang1 1 Division of Mathematical Sciences, School of Physical and Mathematical Sciences, Nanyang Technological University, Singapore 2 Dept. of Electrical Engineering ESAT/COSIC, K.U.Leuven, and Interdisciplinary Institute for BroadBand Technology (IBBT), Kasteelpark Arenberg 10, B–3001 Heverlee, Belgium. [email protected] Abstract. We revisit narrow-pipe designs that are in practical use, and their security against preimage attacks. Our results are the best known preimage attacks on Tiger, MD4, and reduced SHA-2, with the result on Tiger being the first cryptanalytic shortcut attack on the full hash function. Our attacks runs in time 2188.8 for finding preimages, and 2188.2 for second-preimages. Both have memory requirement of order 28, which is much less than in any other recent preimage attacks on reduced Tiger. Using pre-computation techniques, the time complexity for finding a new preimage or second-preimage for MD4 can now be as low as 278.4 and 269.4 MD4 computations, respectively. The second-preimage attack works for all messages longer than 2 blocks. To obtain these results, we extend the meet-in-the-middle framework recently developed by Aoki and Sasaki in a series of papers. In addition to various algorithm-specific techniques, we use a number of conceptually new ideas that are applicable to a larger class of constructions. Among them are (1) incorporating multi-target scenarios into the MITM framework, leading to faster preimages from pseudo-preimages, (2) a simple precomputation technique that allows for finding new preimages at the cost of a single pseudo-preimage, and (3) probabilistic initial structures, to reduce the attack time complexity.
    [Show full text]
  • Certicom Security Builder GSE Datasheet
    Security Builder® GSE™ FIPS 140-2 VALIDATED CRYPTOGRAPHIC MODULE Build trusted, government-approved security into your products. Security Builder® GSE™ enables developers to quickly build client and server-side applications that require a FIPS 140-2 level 1 validation for the cryptographic module. Security Builder GSE acts as a software cryptographic provider within the Certicom® Security Architecture™ – a comprehensive, portable and modular solution designed to allow developers to quickly and cost-effectively embed security across multiple families and generations of devices and applications. MEETS GOVERNMENT SECURITY REQUIREMENTS REDUCES TIME TO MARKET A number of government regulations mandate the use of FIPS By building on Security Builder GSE, you can avoid the lengthy validated modules for the protection of data, especially in a and expensive FIPS validation process and get your product to wireless setting. FIPS also helps demonstrate adherence to market more quickly. Re-validation and re-branding options security best practices. In the US, for instance, compliance are also available if you wish for your product to be listed on with FIPS 140-2 can help manufacturers of network- the NIST Cryptographic Module Validation Program active connected devices and application software demonstrate best validation list. By using a pre-validated module you can meet practice encryption capabilities for protecting patient and user security requirements without diverting valuable resources and data. keep your developers focused on your core application. Security Builder GSE has been validated on a wide variety COMPREHENSIVE SECURITY SOLUTION of high-level and embedded operating systems, including QNX With support for leading client and server-side operating real-time OS, Android and iOS.
    [Show full text]
  • Implementation of Hash Function for Cryptography (Rsa Security)
    International Journal For Technological Research In Engineering Volume 4, Issue 6, February-2017 ISSN (Online): 2347 - 4718 IMPLEMENTATION OF HASH FUNCTION FOR CRYPTOGRAPHY (RSA SECURITY) Syed Fateh Reza1, Mr. Prasun Das2 1M.Tech. (ECE), 2Assistant Professor (ECE), Bitm,Bolpur ABSTRACT: In this thesis, a new method for expected to have a unique hash code and it should be implementing cryptographic hash functions is proposed. generally difficult for an attacker to find two messages with This method seeks to improve the speed of the hash the same hash code. function particularly when a large set of messages with Mathematically, a hash function (H) is defined as follows: similar blocks such as documents with common Headers H: {0, 1}* → {0, 1}n are to be hashed. The method utilizes the peculiar run-time In this notation, {0, 1}* refers to the set of binary elements configurability Feature of FPGA. Essentially, when a block of any length including the empty string while {0, 1}n refers of message that is commonly hashed is identified, the hash to the set of binary elements of length n. Thus, the hash value is stored in memory so that in subsequent occurrences function maps a set of binary elements of arbitrary length to of The message block, the hash value does not need to be a set of binary elements of fixed length. Similarly, the recomputed; rather it is Simply retrieved from memory, thus properties of a hash function are defined as follows: giving a significant increase in speed. The System is self- x {0, 1}*; y {0,1}n learning and able to dynamically build on its knowledge of Pre-image resistance: given y= H(x), it should be difficult to frequently Occurring message blocks without intervention find x.
    [Show full text]
  • IBM® Crypto for C (ICC) Version 8.0.0 FIPS 140-2 Non-Proprietary
    IBM® Crypto for C (ICC) Version 8.0.0 FIPS 140-2 Non-Proprietary Security Policy, version 1.2 December 6, 2010 IBM® Crypto for C (ICC), Version 8.0.0 FIPS 140-2 Non-Proprietary Security Policy, version 1.2 December 6, 2010 This document is the property of International Business Machines Corporation (IBM® Corp.). This document may only be reproduced in its entirety without modifications. © Copyright 2010 IBM Corp. All Rights Reserved Table Of Contents 2. References and Abbreviations ................................................................................ 3 2.1 References ......................................................................................................................... 3 2.2 Abbreviations .................................................................................................................... 3 3 Introduction ............................................................................................................... 5 3.1 Purpose of the Security Policy ......................................................................................... 5 3.2 Target Audience ................................................................................................................ 5 4. Cryptographic Module Definition ................................................................................ 6 4.1 Cryptographic Module Boundary ...................................................................................... 8 5. FIPS 140-2 Specifications .....................................................................................
    [Show full text]
  • Hash Functions & Macs ECE 646 Lecture 9
    ECE 646 Lecture 9 Hash functions & MACs Required Reading W. Stallings, "Cryptography and Network-Security,” Chapter 11 Cryptographic Hash Functions Appendix 11A Mathematical Basis of Birthday Attack Chapter 12 Message Authentication Codes Recommended Reading SHA-3 Project https://csrc.nist.gov/projects/hash-functions/sha-3-project Digital Signature Alice Bob Message Signature Message Signature Hash Hash function function Hash value 1 Hash value yes no Hash value 2 Public key Public key algorithm algorithm Alice’s private key Alice’s public key Hash function arbitrary length m message hash h function h(m) hash value fixed length Vocabulary hash function hash value message digest message digest hash total fingerprint imprint cryptographic checksum compressed encoding MDC, Message Digest Code Hash functions Basic requirements 1. Public description, NO key 2. Compression arbitrary length input ® fixed length output 3. Ease of computation Hash functions Security requirements It is computationally infeasible Given To Find 1. Preimage resistance y x, such that h(x) = y 2. 2nd preimage resistance x’ ¹ x, such that x and y=h(x) h(x’) = h(x) = y 3. Collision resistance x’ ¹ x, such that h(x’) = h(x) Hash functions Dependence between requirements 2nd preimage resistant collision resistant Hash functions (unkeyed) One-Way Collision-Resistant Hash Functions Hash Functions OWHF CRHF preimage resistance 2nd preimage resistance collision resistance Brute force attack against One-Way Hash Function Given y mi’ i=1..2n 2n messages with the contents required by the forger h ? h(mi’) = y n - bits Creating multiple versions of the required message state thereby borrowed I confirm - that I received Mr.
    [Show full text]
  • Research Intuitions of Hashing Crypto System
    Published by : International Journal of Engineering Research & Technology (IJERT) http://www.ijert.org ISSN: 2278-0181 Vol. 9 Issue 12, December-2020 Research Intuitions of Hashing Crypto System 1Rojasree. V, 2Gnana Jayanthi. J, 3Christy Sujatha. D PG & Research Department of Computer Science, Rajah Serfoji Govt. College(A), (Affiliated to Bharathidasan University), Thanjavur-613005, Tamilnadu, India. Abstract—Data transition over the internet has become there is no correlation between input and output bits; and no inevitable. Most data transmitted in the form of multimedia. correlation between output bits, etc. The data transmission must be less complex and user friendly To ensure about the originator of the message, Message at the same time with more security. Message authentication Authentication Code (MAC) is used which can be and integrity is one of the major issues in security data implemented using either symmetric Stream cipher Transmission. There are plenty of methods used to ensure the integrity of data when it is send from the receiver and before it cryptography or Hashing cryptography techniques. reaches the corresponding receiver. If these messages are However, MAC is limited with (i) Establishment of Shared tampered in the midst, it should be intimated to the receiver Secret and (ii) Inability to Provide Non-Repudiation. Even and discarded. Hash algorithms are supposed to provide the some kind of attacks is found like Content modification, integrity but almost all the algorithms have confirmed Sequence modification, Timing modification etc. breakable or less secure. In this review, the performances of This paper is aimed to discuss the several security various hash functions are studied with an analysis from the algorithms based on hash functions in cryptography to point of view of various researchers.
    [Show full text]
  • The Tricky Cryptographic Hash Function (PDF)
    COLUMNS SIGINFO The Tricky Cryptographic Hash Function SIMSON L. GARFINKEL Simson L. Garfinkel is a Senior ryptographic hash functions are one of the building blocks of modern Computer Scientist at the US computing systems. Although they were originally developed for sign- Census Bureau and a researcher ing digital signatures with public key cryptography, they have found in digital forensics and usability. C He recently published The uses in digital forensics, digital timestamping, and cryptocurrency schemes Computer Book, a coffee table book about the like Bitcoin. history of computing. [email protected] Cryptographic hash functions like MD5, SHA-1, and BLAKE3 are widely used and appreci- ated by programmers, end users, and even lawyers! Nevertheless, I’ll start off this column with a basic description of what hash functions are and the hash functions that are used today. Then I’ll delve back to the first references to them that I’ve been able to find and give a bit of their history. I’ll briefly touch on their uses in cryptography and then discuss how they also found use in digital forensics. I’ll end with a puzzle from Stuart Haber, one of the co-inven- tors of the blockchain concept. Unless otherwise noted, all of the timing runs were performed on my Mac mini (vintage 2018) with a six-core Intel Core i5 processor running at 3 GHz. The hashing was done with OpenSSL 1.1.1d, compiled September 10, 2019, that ships with the Anaconda Python distribution. Hash Functions Hash functions take a sequence of bytes of any length and crunch it down to a block of seem- ingly random bits and a constant length.
    [Show full text]
  • Generating Random Numbers and Computing Cryptographic Hashes (Digests)
    Random Numbers and Cryptographic Hashes Generating random numbers and computing cryptographic hashes (digests). Overview > Random number generation and random streams > Cryptographic Hashes/Digests Random Numbers > POCO includes a pseudo random number generator (PRNG), using a nonlinear additive feedback algorithm with 256 bits of state information and a period of up to 269. > The PRNG can generate 31 bit pseudo random numbers. > It can generate UInt32, char, bool, float and double random values. > In addition, there is a stream class providing a stream of random bytes (using /dev/random or the Windows crypto APIs). The Random Class > POCO::Random implements a PRNG. > #include "Poco/Random.h" > void seed(Poco::UInt32 seed) seeds the PRNG using the given seed. > void seed() seeds the PRNG using random data (from RandomInputStream) > The constructor only seeds the PRNG using the current date and time. For better seeding, explicitely call one of the seed() methods. ! The Random Class (cont'd) > UInt32 next() returns pseudo random number in the range [0, 231) > UInt32 next(UInt32 n) returns a pseudo random number in the range [0, n) > char nextChar() returns a pseudo random character > bool nextBool() return a pseudo random boolean > float nextFloat(), double nextDouble() return a pseudo random floating point value in the range [0, 1] The RandomInputStream Class > Poco::RandomInputStream is an istream that produces an endless sequence of random bytes. > #include "Poco/RandomStream.h" > The random bytes are taken from /dev/random, or the Windows
    [Show full text]
  • Cryptography Hash Functions
    CCRRYYPPTTOOGGRRAAPPHHYY HHAASSHH FFUUNNCCTTIIOONNSS http://www.tutorialspoint.com/cryptography/cryptography_hash_functions.htm Copyright © tutorialspoint.com Hash functions are extremely useful and appear in almost all information security applications. A hash function is a mathematical function that converts a numerical input value into another compressed numerical value. The input to the hash function is of arbitrary length but output is always of fixed length. Values returned by a hash function are called message digest or simply hash values. The following picture illustrated hash function − Features of Hash Functions The typical features of hash functions are − Fixed Length Output HashValue Hash function coverts data of arbitrary length to a fixed length. This process is often referred to as hashing the data. In general, the hash is much smaller than the input data, hence hash functions are sometimes called compression functions. Since a hash is a smaller representation of a larger data, it is also referred to as a digest. Hash function with n bit output is referred to as an n-bit hash function. Popular hash functions generate values between 160 and 512 bits. Efficiency of Operation Generally for any hash function h with input x, computation of hx is a fast operation. Computationally hash functions are much faster than a symmetric encryption. Properties of Hash Functions In order to be an effective cryptographic tool, the hash function is desired to possess following properties − Pre-Image Resistance This property means that it should be computationally hard to reverse a hash function. In other words, if a hash function h produced a hash value z, then it should be a difficult process to find any input value x that hashes to z.
    [Show full text]