1. Technical Field
The present disclosure relates to software security and more specifically to a hash function that can be used in conjunction with cryptography.
2. Introduction
In modern cryptography, one common methodology is the use of mathematical problems that are considered algorithmically hard to solve, in order to give bricks to design strong systems. One such difficult mathematical problem is factorization or the discrete logarithm problem. This approach is very efficient, and was one of the key elements transforming the art of cryptography into a real science. One aspect of the success of basing cryptography on hard problems is mathematically provable levels of security. With some mathematical proof and rigorous analysis, certain security features of a cryptographic scheme can be proven, supposing only that these problems are resistant to attacking algorithms in practice.
Cryptography can include several different components, such as signature, encryption, and hashing. An attacker can more easily unravel, crack, or reverse engineer a cryptographic scheme if he can find a vulnerability in one of those components. Accordingly, any improvements or variations to these components can enhance the security afforded by cryptographic security schemes.
Additional features and advantages of the disclosure will be set forth in the description which follows, and in part will be obvious from the description, or can be learned by practice of the herein disclosed principles. The features and advantages of the disclosure can be realized and obtained by means of the instruments and combinations particularly pointed out in the appended claims. These and other features of the disclosure will become more fully apparent from the following description and appended claims, or can be learned by the practice of the principles set forth herein.
Cryptography generally includes several different components, such as signature, encryption, and hashing. This disclosure is directed to hashing. Specifically, the hashing approaches set forth herein are based on the Collatz conjecture. In 1937, Lothar Collatz introduced a now well-known conjecture. The Collatz conjecture is based on a set of operations for a given number n.
The progressions of numbers provided by the Collatz conjecture can be applied to generate hashes for use in cryptographic systems. In one simple example, a hash function takes a value n and a value r as input. The hash function performs the Collatz conjecture on the value n for r iterations, and outputs the ending value after r iterations as the hash value. For example, given the simple Collatz conjecture and the input value 402 of 33 as shown in
Disclosed are systems, methods, and non-transitory computer-readable storage media for generating hashes based on the Collatz conjecture. An exemplary system receives an input value and an iteration value. For the number of the iteration value, iteratively performing the following steps: if a least significant bit of the input value is 0, dividing the input value by a first value (such as 2), and if a least significant bit of the input value is 1, (1) multiplying the input value by a second value (such as 3), (2) adding one to the input value, and (3) applying a modulo operation of a prime value to the input value, to yield a first iteration value. These steps yield an updated input value for use in a subsequent iteration. Then the system returns the updated input value as a hash value which can be used in a cryptographic function.
In an alternative optimization of the hash function, the system receives an input value and an iteration value, and, based on the iteration value, iteratively performs the following steps: if a least significant bit of the input value is 0, right bit shifting the input value by one bit; if the least significant bit of the input value is 1, and the input value is less than a prime number divided by three, multiplying the input value by 3 and adding 1; if the least significant bit of the input value is 1, and the input value is greater than the prime number divided by 3 and less than 2 times the prime number divided by 3, multiplying the input value by 3, adding 1, and subtracting the prime number; and if the least significant bit of the input value is 1, and the input value is greater than 2 times the prime number divided by 3, multiplying the input value by 3, adding 1, and subtracting 2 times the prime number. These steps produce an updated input value, which the system returns as a hash value.
In a message preparation embodiment, the system receives a message and splits the message into a set of blocks. The system divides each block of the set of blocks into a set of sub-blocks. For each of the set of sub-blocks, the system generates a value based on a hash calculation using values from the set of sub-blocks, and combines the value with a respective one of the set of sub-blocks. Combining the value and the respective one of the set of sub-blocks can include prepending, appending, and otherwise interspersing the value within a particular sub-block. Then the system recombines the set of blocks into a padded message. The hash calculation can be SHA1, SHA2, SHA256, SHA512, a Collatz conjecture based calculation, and/or MD5. Sub-blocks can include one or more reserved portions in to which the value is inserted. For optimization purposes, the size of the value plus a sub-block can be a power of two. These approaches provide a substitute hash algorithm that can provide similar functionality and can be drop-in replacement for virtually any hash function.
In order to describe the manner in which the above-recited and other advantages and features of the disclosure can be obtained, a more particular description of the principles briefly described above will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings. Understanding that these drawings depict only exemplary embodiments of the disclosure and are not therefore to be considered to be limiting of its scope, the principles herein are described and explained with additional specificity and detail through the use of the accompanying drawings in which:
Various embodiments of the disclosure are discussed in detail below. While specific implementations are discussed, it should be understood that this is done for illustration purposes only. A person skilled in the relevant art will recognize that other components and configurations may be used without parting from the spirit and scope of the disclosure.
The present disclosure addresses the need in the art for different types of hash functions which can be used in cryptography. A brief introductory description of a basic general purpose system or computing device in
With reference to
The system bus 110 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. A basic input/output system (BIOS) stored in ROM 140 or the like, may provide the basic routine that helps to transfer information between elements within the computing device 100, such as during start-up. The computing device 100 further includes storage devices 160 such as a hard disk drive, a magnetic disk drive, an optical disk drive, tape drive or the like. The storage device 160 can include software modules 162, 164, 166 for controlling the processor 120. Other hardware or software modules are contemplated. The storage device 160 is connected to the system bus 110 by a drive interface. The drives and the associated computer readable storage media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for the computing device 100. In one aspect, a hardware module that performs a particular function includes the software component stored in a non-transitory computer-readable medium in connection with the necessary hardware components, such as the processor 120, bus 110, display 170, and so forth, to carry out the function. The basic components are known to those of skill in the art and appropriate variations are contemplated depending on the type of device, such as whether the device 100 is a small, handheld computing device, a desktop computer, or a computer server.
Although the exemplary embodiment described herein employs the hard disk 160, it should be appreciated by those skilled in the art that other types of computer readable media which can store data that are accessible by a computer, such as magnetic cassettes, flash memory cards, digital versatile disks, cartridges, random access memories (RAMs) 150, read only memory (ROM) 140, a cable or wireless signal containing a bit stream and the like, may also be used in the exemplary operating environment. Non-transitory computer-readable storage media expressly exclude media such as energy, carrier signals, electromagnetic waves, and signals per se.
To enable user interaction with the computing device 100, an input device 190 represents any number of input mechanisms, such as a microphone for speech, a touch-sensitive screen for gesture or graphical input, keyboard, mouse, motion input, speech and so forth. An output device 170 can also be one or more of a number of output mechanisms known to those of skill in the art. In some instances, multimodal systems enable a user to provide multiple types of input to communicate with the computing device 100. The communications interface 180 generally governs and manages the user input and system output. There is no restriction on operating on any particular hardware arrangement and therefore the basic features here may easily be substituted for improved hardware or firmware arrangements as they are developed.
For clarity of explanation, the illustrative system embodiment is presented as including individual functional blocks including functional blocks labeled as a “processor” or processor 120. The functions these blocks represent may be provided through the use of either shared or dedicated hardware, including, but not limited to, hardware capable of executing software and hardware, such as a processor 120, that is purpose-built to operate as an equivalent to software executing on a general purpose processor. For example the functions of one or more processors presented in
The logical operations of the various embodiments are implemented as: (1) a sequence of computer implemented steps, operations, or procedures running on a programmable circuit within a general use computer, (2) a sequence of computer implemented steps, operations, or procedures running on a specific-use programmable circuit; and/or (3) interconnected machine modules or program engines within the programmable circuits. The system 100 shown in
Having disclosed some components of a computing system, the disclosure now returns to a discussion of hashing and related operations based on the Collatz conjecture. The variations set forth herein illustrate different ways to create a hash function based on the Collatz conjecture. In one example, p is a prime, and Cr( ) denotes a generalization of the Collatz function. Given an input value n, the Cr(n) function operates as shown in the pseudo code below for the given input n and a round number r:
Note all the operations are done in the Galois Field of p (or GF(p)={0, . . . , p−1}), otherwise known as a finite field or a field containing a finite number of discrete elements. For example, the bit shift operation does not need modular specific operation. A different optimization, shown in the pseudo code below, demonstrates steps functionally equivalent to the 3*y+1 operation that can also be performed without a modular specific operation.
Thus the 3*y+1 operation can be accomplished using only comparison, right shift and addition operations on potentially very large numbers, which can be a significant computational overhead savings over performing multiplications on such very large numbers. These operations are much less computationally expensive and can facilitate more iterations and/or lower processor cost when generating hashes.
The block diagram begins with an initial value for n and an iteration value indicating how many Collatz conjecture (or related) iterations to apply to n. Thus, if the iteration value is greater than 0, a system implementing the block diagram checks if n is even or odd, such as with a function call or by determining whether the least significant bit of n is a 1 or a 0. If n is even, the system applies an even operation to n. In the classic Collatz conjecture, this operation is a division by 2, but can encompass variations or an entirely different operation. If n is odd, the system applies an odd operation to n. The classic Collatz conjecture multiplies n by 3 and adds 1, but this operation can include other variations as well. Specific variations are set forth throughout this disclosure, some of which include various prime values, modulo operations, and different coefficient values for multiplication operations. After performing the odd or even operation on n, the system decrements the iteration value, and checks if the iteration value is greater than 0. The system can continue with another iteration of checking if n is odd or even, or can finish. While
The input value and the number of iterations can be received as part of a function call, in which the output iteration value is a return value for the function call, or these values can be identified in other ways, such as being passed as part of a network-based request. Processing the same input value using the same algorithm for a same number of iterations provides the same resulting hash value.
Another use of the functions set forth herein is padding blocks 504 of a message 502, as set forth in the block diagram 500 of
The system receives a message to pad. The message can include any quantity and type of data. In this example, each of the resulting padded blocks of the message will be 512 bits, of which 448 bits are message, and 64 bits are a hash value. Other ratios of message data to hash value can be used as well. The system determines a size of a message m, and pads, if necessary, the message m with 0s, 1s, or some pattern of 1s and 0s to make the size a multiple of 448 bits. Then, the system divides the message m into a set of 448-bit blocks, M. For each block M, the system decomposes M into 32-bit or 64 bit blocks Mi. For i in 0 to 1, the system (1) computes a temporary_value by M(0+7*i)+M(1+7*i)+M(6+7*i), (2) computes val=Cr(temporary_value), and (3) combines val to M. The system can combine val with M via prepending, appending, or other combination, such as by interspersing different strings of bits of val within M at predetermined locations. After performing this operation on the blocks M, the system recomposes the blocks M into a new message m. Thus, the new message m is larger than the original message m. Hash values for each block M can be generated based on the contents of the respective block M. Then the hashing function can be used classically, such as using SHA1 or SHA2.
In another variation, the system receives a message to pad with hash values, and splits the message into a set of blocks. For each block of the set of blocks, the system divides each block into a set of sub-blocks. For each of the set of sub-blocks, the system (1) generates a value based on a hash calculation using values from the set of sub-blocks, and combines the value with a respective one of the set of sub-blocks. Then the system recombines the set of sub-blocks and the set of blocks into a padded message. The hash calculation can include SHA1, SHA2, SHA256, SHA512, a Collatz conjecture based calculation, and/or MD5. The sub-blocks can include a reserved portion in to which the value is inserted.
The hash function can implement an extension of the Cr( ) function denoted Cr,p1,p2( ), where p1 and p2 are prime values. Exemplary pseudo code for the function Cr,p1,p2( ), is set forth below:
where p1 and p2 are two prime numbers part of the definition of the hash function. P1 and p2 can also be used for padding, as before.
A set number of iterations of these steps to the input value yields an updated input value (910) which can be returned in response to a function call (912). The first prime value, the second prime value, and the third prime value can be passed as parameters or variables to the function, or can be incorporated as part of the function. The second prime value can be any prime number, but can optionally correspond to the block size. For example, if the block size is 512 bits, then the second prime can be smaller than 2512. The updated input value can be used in padding 512 bit sub-blocks of a message m.
In a hash scheme, p can be a defined prime internally used, and smaller than 2512, in Cr,p1,p2( ) m can be a message to be hashed. The hash operation is defined as follows:
The hash functions set forth herein incorporate computations based on a modification to the Collatz conjecture that achieves sufficient security for cryptographic usage.
The exemplary method embodiments shown in
Embodiments within the scope of the present disclosure may also include tangible and/or non-transitory computer-readable storage media for carrying or having computer-executable instructions or data structures stored thereon. Such non-transitory computer-readable storage media can be any available media that can be accessed by a general purpose or special purpose computer, including the functional design of any special purpose processor as discussed above. By way of example, and not limitation, such non-transitory computer-readable media can include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store desired program code means in the form of computer-executable instructions, data structures, or processor chip design. When information is transferred or provided over a network or another communications connection (either hardwired, wireless, or combination thereof) to a computer, the computer properly views the connection as a computer-readable medium. Thus, any such connection is properly termed a computer-readable medium. Combinations of the above should also be included within the scope of the computer-readable media.
Computer-executable instructions include, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Computer-executable instructions also include program modules that are executed by computers in stand-alone or network environments. Generally, program modules include routines, programs, components, data structures, objects, and the functions inherent in the design of special-purpose processors, etc. that perform particular tasks or implement particular abstract data types. Computer-executable instructions, associated data structures, and program modules represent examples of the program code means for executing steps of the methods disclosed herein. The particular sequence of such executable instructions or associated data structures represents examples of corresponding acts for implementing the functions described in such steps.
Those of skill in the art will appreciate that other embodiments of the disclosure may be practiced in network computing environments with many types of computer system configurations, including personal computers, hand-held devices, multi-processor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. Embodiments may also be practiced in distributed computing environments where tasks are performed by local and remote processing devices that are linked (either by hardwired links, wireless links, or by a combination thereof) through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
The various embodiments described above are provided by way of illustration only and should not be construed to limit the scope of the disclosure. Those skilled in the art will readily recognize various modifications and changes that may be made to the principles described herein without following the example embodiments and applications illustrated and described herein, and without departing from the spirit and scope of the disclosure.
This application claims the benefit of U.S. Provisional Patent Application No. 61/554,411, entitled “SYSTEM AND METHOD FOR A COLLATZ BASED HASH FUNCTION”, filed on Nov. 1, 2011, and which is hereby expressly incorporated herein by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
61554411 | Nov 2011 | US |