Lyra2

Last updated

Lyra2 is a password hashing scheme (PHS) that can also work as a key derivation function (KDF). It received a special recognition during the Password Hashing Competition in July 2015, [1] which was won by Argon2. It is also used in proof-of-work algorithms such as Lyra2REv2, [2] adopted by Vertcoin, [3] MonaCoin, [4] among other cryptocurrencies. [5] Lyra2 was designed by Marcos A. Simplicio Jr., Leonardo C. Almeida, Ewerton R. Andrade, Paulo C. F. dos Santos, and Paulo S. L. M. Barreto from Escola Politécnica da Universidade de São Paulo. [6] It is an improvement over Lyra, [7] [8] previously proposed by the same authors. Lyra2 preserves the security, efficiency and flexibility of its predecessor, including: (1) the ability to configure the desired amount of memory, processing time and parallelism to be used by the algorithm; and (2) the capacity of providing a high memory usage with a processing time similar to that obtained with scrypt. In addition, it brings the following improvements when compared to its predecessor: [9]

Contents

This algorithm enables parameterization in terms of: [10]

Strengths

The core strengths of the algorithm are as follows- [5] [10]

Design

As any PHS, Lyra2 takes as input a salt and a password, creating a pseudorandom output that can then be used as key material for cryptographic algorithms or as an authentication string. [11] [ failed verification ][ citation needed ]

Internally, the scheme's memory is organized as a matrix that is expected to remain in memory during the whole password hashing process: since its cells are iteratively read and written, discarding a cell for saving memory leads to the need of recomputing it whenever it is accessed once again, until the point it was last modified. [5]

The construction and visitation of the matrix is done using a stateful combination of the absorbing, squeezing and duplexing operations of the underlying sponge (i.e., its internal state is never reset to zero), ensuring the sequential nature of the whole process.

Also, the number of times the matrix's cells are revisited after initialization is defined by the user, allowing Lyra2's execution time to be fine-tuned according to the target platform's resources.

Functions/symbols

||    Concatenate two strings ^    Bitwise XOR [+]    Wordwise add operation (i.e., ignoring carries between words) %    Modulus W    The target machine's word size (usually, 32 or 64) omega    Number of bits to be used in rotations (recommended: a multiple of the machine's word size, W) >>>    Right rotation rho    Number of rounds for reduced squeeze or duplexing operations blen    Sponge's block size in bytes  H or H_i   Sponge with block size blen (in bytes) and underlying permutation f H.absorb(input)   Sponge's absorb operation on input H.squeeze(len)   Sponge's squeeze operation of len bytes H.squeeze_{rho}(len)  Sponge's squeeze operation of len bytes using rho rounds of f H.duplexing(input,len)  Sponge's duplexing operation on input, producing len bytes H.duplexing_{rho}(input,len) Sponge's duplexing operation on input, using rho rounds of f, producing len bytes pad(string)   Pads a string to a multiple of blen bytes (padding rule: 10*1) lsw(input)   The least significant word of input len(string)   Length of a string, in bytes syncThreads()   Synchronize parallel threads swap(input1,input2)  Swap the value of two inputs C    Number of columns on the memory matrix (usually, 64, 128, 256, 512 or 1024) P    Degree of parallelism (P >= 1 and (m_cost/2) % P = 0) 

Inputs

Algorithm without parallelism

** Bootstrapping phase: Initializes the sponge's state and local variables # Byte representation of input parameters (others can be added) params =  outlen || len(password) || len(salt) || t_cost || m_cost || C  # Initializes the sponge's state (after that, password can be overwritten) H.absorb( pad(password || salt || params) )  # Initializes visitation step, window and first rows that will feed  gap = 1 stp = 1 wnd = 2 sqrt = 2  prev0 = 2 row1 = 1 prev1 = 0  ** Setup phase: Initializes a (m_cost x C) memory matrix, its cells having blen-byte cells  # Initializes M[0], M[1] and M[2] for col = 0 to C-1  M[0][C-1-col] = H.squeeze_{rho}(blen) for col = 0 to C-1  M[1][C-1-col] = H.duplexing_{rho}( M[0][col], blen) for col = 0 to C-1  M[2][C-1-col] = H.duplexing_{rho}( M[1][col], blen)  # Filling Loop: initializes remainder rows for row0 = 3 to m_cost-1  # Columns Loop: M[row0] is initialized and M[row1] is updated  for col = 0 to C-1   rand = H.duplexing_{rho}( M[row1][col] [+] M[prev0][col] [+] M[prev1][col], blen)   M[row0][C-1-col] = M[prev0][col] ^ rand   M[row1][col] = M[row1][col] ^ ( rand >>> omega )   # Rows to be revisited in next loop  prev0 = row0  prev1 = row1  row1 = (row1 + stp) % wnd   # Window fully revisited  if (row1 = 0)   # Doubles window and adjusts step   wnd = 2 * wnd   stp = sqrt + gap   gap = -gap      # Doubles sqrt every other iteration   if (gap = -1)    sqrt = 2 * sqrt   ** Wandering phase: Iteratively overwrites pseudorandom cells of the memory matrix  # Visitation Loop: (2 * m_cost * t_cost) rows revisited in pseudorandom fashion for wCount = 0 to ( (m_cost * t_cost) - 1)  # Picks pseudorandom rows  row0 = lsw(rand) % m_cost  row1 = lsw( rand >>> omega ) % m_cost   # Columns Loop: updates both M[row0] and M[row1]  for col = 0 to C-1   # Picks pseudorandom columns   col0 = lsw( ( rand >>> omega ) >>> omega ) % C   col1 = lsw( ( ( rand >>> omega ) >>> omega ) >>> omega ) % C    rand = H.duplexing_{rho}( M[row0][col] [+] M[row1][col] [+] M[prev0][col0] [+] M[prev1][col1], blen)   M[row0][col] = M[row0][col] ^ rand   M[row1][col] = M[row1][col] ^ ( rand >>> omega )   # Next iteration revisits most recently updated rows  prev0 = row0  prev1 = row1  ** Wrap-up phase: output computation  # Absorbs a final column with a full-round sponge H.absorb( M[row0][0] )  # Squeezes outlen bits with a full-round sponge output = H.squeeze(outlen)  # Provides outlen-long bitstring as output return output

Algorithm with parallelism

for each i in [0..P]  ** Bootstrapping phase: Initializes the sponge's state and local variables    # Byte representation of input parameters (others can be added)  params =  outlen || len(password) || len(salt) || t_cost || m_cost || C || P || i   # Initializes the sponge's state (after that, password can be overwritten)  H_i.absorb( pad(password || salt || params) )   # Initializes visitation step, window and first rows that will feed   gap = 1  stp = 1  wnd = 2  sqrt = 2  sync = 4  j = i   prev0 = 2  rowP = 1  prevP = 0   ** Setup phase: Initializes a (m_cost x C) memory matrix, its cells having blen-byte cells   # Initializes M_i[0], M_i[1] and M_i[2]  for col = 0 to C-1   M_i[0][C-1-col] = H_i.squeeze_{rho}(blen)  for col = 0 to C-1   M_i[1][C-1-col] = H_i.duplexing_{rho}( M_i[0][col], blen)  for col = 0 to C-1   M_i[2][C-1-col] = H_i.duplexing_{rho}( M_i[1][col], blen)   # Filling Loop: initializes remainder rows  for row0 = 3 to ( (m_cost / P) - 1 )   # Columns Loop: M_i[row0] is initialized and M_j[row1] is updated   for col = 0 to C-1    rand = H_i.duplexing_{rho}( M_j[rowP][col] [+] M_i[prev0][col] [+] M_j[prevP][col], blen)    M_i[row0][C-1-col] = M_i[prev0][col] ^ rand    M_j[rowP][col] = M_j[rowP][col] ^ ( rand >>> omega )    # Rows to be revisited in next loop   prev0 = row0   prevP = rowP   rowP = (rowP + stp) % wnd    # Window fully revisited   if (rowP = 0)    # Doubles window and adjusts step    wnd = 2 * wnd    stp = sqrt + gap    gap = -gap       # Doubles sqrt every other iteration    if (gap = -1)     sqrt = 2 * sqrt      # Synchronize point   if (row0 = sync)    sync = sync + (sqrt / 2)    j = (j + 1) % P    syncThreads()   syncThreads()    ** Wandering phase: Iteratively overwrites pseudorandom cells of the memory matrix   wnd = m_cost / (2 * P)  sync = sqrt  off0 = 0  offP = wnd   # Visitation Loop: (2 * m_cost * t_cost / P) rows revisited in pseudorandom fashion  for wCount = 0 to ( ( (m_cost * t_cost) / P) - 1)   # Picks pseudorandom rows and slices (j)   row0 = off0 + (lsw(rand) % wnd)   rowP = offP + (lsw( rand >>> omega ) % wnd)   j = lsw( ( rand >>> omega ) >>> omega ) % P    # Columns Loop: update M_i[row0]   for col = 0 to C-1    # Picks pseudorandom column     col0 = lsw( ( ( rand >>> omega ) >>> omega ) >>> omega ) % C     rand = H_i.duplexing_{rho}( M_i[row0][col] [+] M_i[prev0][col0] [+] M_j[rowP][col], blen)    M_i[row0][col] = M_i[row0][col] ^ rand    # Next iteration revisits most recently updated rows   prev0 = row0      # Synchronize point   if (wCount = sync)    sync = sync + sqrt    swap(off0,offP)    syncThreads()   syncThreads()   ** Wrap-up phase: output computation   # Absorbs a final column with a full-round sponge  H_i.absorb( M_i[row0][0] )   # Squeezes outlen bits with a full-round sponge  output_i = H_i.squeeze(outlen)  # Provides outlen-long bitstring as output return output_0 ^ ... ^ output_{P-1} 

Security analysis

Against Lyra2, the processing cost of attacks using of the amount of memory employed by a legitimate user is expected to be between and , the latter being a better estimate for , instead of the achieved when the amount of memory is , where is a user-defined parameter to define a processing time.

This compares well to Scrypt, which displays a cost of when the memory usage is , [12] and with other solutions in the literature, for which the results are usually . [7] [13] [14] [15]

Nonetheless, in practice these solutions usually involve a value of (memory usage) lower than those attained with the Lyra2 for the same processing time. [16] [17] [18] [19] [20]

Performance

Performance of SSE-enabled Lyra2, for C = 256, r = 1, p = 1, and different T and R settings, compared with SSE-enabled Scrypt and memory-hard PHC finalists with minimum parameters. Lyra2-Bench.pdf
Performance of SSE-enabled Lyra2, for C = 256, ρ = 1, p = 1, and different T and R settings, compared with SSE-enabled Scrypt and memory-hard PHC finalists with minimum parameters.

The processing time obtained with a SSE single-core implementation of Lyra2 are illustrated in the hereby shown figure. This figure was extracted from, [9] and is very similar of third-party benchmarks performed during the PHC context. [16] [17] [18] [19] [20]

The results depicted correspond to the average execution time of Lyra2 configured with , , bits (i.e., the inner state has 256 bits), and different and settings, giving an overall idea of possible combinations of parameters and the corresponding usage of resources.

As shown in this figure, Lyra2 is able to execute in: less than 1 s while using up to 400 MB (with and ) or up to 1 GB of memory (with and ); or in less than 5 s with 1.6 GB (with and ).

All tests were performed on an Intel Xeon E5-2430 (2.20 GHz with 12 Cores, 64 bits) equipped with 48 GB of DRAM, running Ubuntu 14.04 LTS 64 bits, and the source code was compiled using gcc 4.9.2. [9]

Related Research Articles

<span class="mw-page-title-main">Skin effect</span> Tendency of AC current flow in a conductors outer layer

In electromagnetism, skin effect is the tendency of an alternating electric current (AC) to become distributed within a conductor such that the current density is largest near the surface of the conductor and decreases exponentially with greater depths in the conductor. It is caused by opposing eddy currents induced by the changing magnetic field resulting from the alternating current. The electric current flows mainly at the skin of the conductor, between the outer surface and a level called the skin depth. Skin depth depends on the frequency of the alternating current; as frequency increases, current flow becomes more concentrated near the surface, resulting in less skin depth. Skin effect reduces the effective cross-section of the conductor and thus increases its effective resistance. At 60 Hz in copper, skin depth is about 8.5 mm. At high frequencies, skin depth becomes much smaller.

<span class="mw-page-title-main">Key derivation function</span> Function that derives secret keys from a secret value

In cryptography, a key derivation function (KDF) is a cryptographic algorithm that derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function. KDFs can be used to stretch keys into longer keys or to obtain keys of a required format, such as converting a group element that is the result of a Diffie–Hellman key exchange into a symmetric key for use with AES. Keyed cryptographic hash functions are popular examples of pseudorandom functions used for key derivation.

<span class="mw-page-title-main">Stellar dynamics</span>

Stellar dynamics is the branch of astrophysics which describes in a statistical way the collective motions of stars subject to their mutual gravity. The essential difference from celestial mechanics is that the number of body

Plasma oscillations, also known as Langmuir waves, are rapid oscillations of the electron density in conducting media such as plasmas or metals in the ultraviolet region. The oscillations can be described as an instability in the dielectric function of a free electron gas. The frequency depends only weakly on the wavelength of the oscillation. The quasiparticle resulting from the quantization of these oscillations is the plasmon.

<span class="mw-page-title-main">Friedmann equations</span> Equations in physical cosmology

The Friedmann equations, also known as the Friedmann-Lemaître or FL equations, are a set of equations in physical cosmology that govern the expansion of space in homogeneous and isotropic models of the universe within the context of general relativity. They were first derived by Alexander Friedmann in 1922 from Einstein's field equations of gravitation for the Friedmann–Lemaître–Robertson–Walker metric and a perfect fluid with a given mass density ρ and pressure p. The equations for negative spatial curvature were given by Friedmann in 1924.

A random password generator is a software program or hardware device that takes input from a random or pseudo-random number generator and automatically generates a password. Random passwords can be generated manually, using simple sources of randomness such as dice or coins, or they can be generated using a computer.

The Kerr–Newman metric is the most general asymptotically flat and stationary solution of the Einstein–Maxwell equations in general relativity that describes the spacetime geometry in the region surrounding an electrically charged and rotating mass. It generalizes the Kerr metric by taking into account the field energy of an electromagnetic field, in addition to describing rotation. It is one of a large number of various different electrovacuum solutions; that is, it is a solution to the Einstein–Maxwell equations that account for the field energy of an electromagnetic field. Such solutions do not include any electric charges other than that associated with the gravitational field, and are thus termed vacuum solutions.

<span class="mw-page-title-main">Scale height</span>

In atmospheric, earth, and planetary sciences, a scale height, usually denoted by the capital letter H, is a distance over which a physical quantity decreases by a factor of e.

In the mathematical description of general relativity, the Boyer–Lindquist coordinates are a generalization of the coordinates used for the metric of a Schwarzschild black hole that can be used to express the metric of a Kerr black hole.

The Kuramoto model, first proposed by Yoshiki Kuramoto, is a mathematical model used in describing synchronization. More specifically, it is a model for the behavior of a large set of coupled oscillators. Its formulation was motivated by the behavior of systems of chemical and biological oscillators, and it has found widespread applications in areas such as neuroscience and oscillating flame dynamics. Kuramoto was quite surprised when the behavior of some physical systems, namely coupled arrays of Josephson junctions, followed his model.

<span class="mw-page-title-main">LOCC</span> Method in quantum computation and communication

LOCC, or local operations and classical communication, is a method in quantum information theory where a local (product) operation is performed on part of the system, and where the result of that operation is "communicated" classically to another part where usually another local operation is performed conditioned on the information received.

In mathematics, the generalized minimal residual method (GMRES) is an iterative method for the numerical solution of an indefinite nonsymmetric system of linear equations. The method approximates the solution by the vector in a Krylov subspace with minimal residual. The Arnoldi iteration is used to find this vector.

In probability theory and statistics, partial correlation measures the degree of association between two random variables, with the effect of a set of controlling random variables removed. When determining the numerical relationship between two variables of interest, using their correlation coefficient will give misleading results if there is another confounding variable that is numerically related to both variables of interest. This misleading information can be avoided by controlling for the confounding variable, which is done by computing the partial correlation coefficient. This is precisely the motivation for including other right-side variables in a multiple regression; but while multiple regression gives unbiased results for the effect size, it does not give a numerical value of a measure of the strength of the relationship between the two variables of interest.

A hydrogen-like atom (or hydrogenic atom) is any atom or ion with a single valence electron. These atoms are isoelectronic with hydrogen. Examples of hydrogen-like atoms include, but are not limited to, hydrogen itself, all alkali metals such as Rb and Cs, singly ionized alkaline earth metals such as Ca+ and Sr+ and other ions such as He+, Li2+, and Be3+ and isotopes of any of the above. A hydrogen-like atom includes a positively charged core consisting of the atomic nucleus and any core electrons as well as a single valence electron. Because helium is common in the universe, the spectroscopy of singly ionized helium is important in EUV astronomy, for example, of DO white dwarf stars.

SHA-3 is the latest member of the Secure Hash Algorithm family of standards, released by NIST on August 5, 2015. Although part of the same series of standards, SHA-3 is internally different from the MD5-like structure of SHA-1 and SHA-2.

In cryptography, scrypt is a password-based key derivation function created by Colin Percival in March 2009, originally for the Tarsnap online backup service. The algorithm was specifically designed to make it costly to perform large-scale custom hardware attacks by requiring large amounts of memory. In 2016, the scrypt algorithm was published by IETF as RFC 7914. A simplified version of scrypt is used as a proof-of-work scheme by a number of cryptocurrencies, first implemented by an anonymous programmer called ArtForz in Tenebrix and followed by Fairbrix and Litecoin soon after.

<span class="mw-page-title-main">Sponge function</span> Theory of cryptography

In cryptography, a sponge function or sponge construction is any of a class of algorithms with finite internal state that take an input bit stream of any length and produce an output bit stream of any desired length. Sponge functions have both theoretical and practical uses. They can be used to model or implement many cryptographic primitives, including cryptographic hashes, message authentication codes, mask generation functions, stream ciphers, pseudo-random number generators, and authenticated encryption.

Quantum stochastic calculus is a generalization of stochastic calculus to noncommuting variables. The tools provided by quantum stochastic calculus are of great use for modeling the random evolution of systems undergoing measurement, as in quantum trajectories. Just as the Lindblad master equation provides a quantum generalization to the Fokker–Planck equation, quantum stochastic calculus allows for the derivation of quantum stochastic differential equations (QSDE) that are analogous to classical Langevin equations.

Argon2 is a key derivation function that was selected as the winner of the 2015 Password Hashing Competition. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg. The reference implementation of Argon2 is released under a Creative Commons CC0 license or the Apache License 2.0, and provides three related versions:

In quantum mechanics, a Dirac membrane is a model of a charged membrane introduced by Paul Dirac in 1962. Dirac's original motivation was to explain the mass of the muon as an excitation of the ground state corresponding to an electron. Anticipating the birth of string theory by almost a decade, he was the first to introduce what is now called a type of Nambu–Goto action for membranes.

References

  1. "Password Hashing Competition". password-hashing.net. Retrieved 2016-03-22.
  2. "Lyra2REv2". eprint.iacr.org. Retrieved 2016-03-22.
  3. "Vertcoin". vertcoin.org. Retrieved 2019-10-08.
  4. "MonaCoin". monacoin.org. Retrieved 2019-10-08.
  5. 1 2 3 van Beirendonck, M.; Trudeau, L.; Giard, P.; Balatsoukas-Stimming, A. (2019-05-29). A Lyra2 FPGA Core for Lyra2REv2-Based Cryptocurrencies. IEEE International Symposium on Circuits and Systems (ISCAS). Sapporo, Japan: IEEE. pp. 1–5. arXiv: 1807.05764 . doi:10.1109/ISCAS.2019.8702498.
  6. "Cryptology ePrint Archive: Report 2015/136". eprint.iacr.org. Retrieved 2016-03-22.
  7. 1 2 Almeida, Leonardo C.; Andrade, Ewerton R.; Barreto, Paulo S. L. M.; Simplicio Jr, Marcos A. (2014-01-04). "Lyra: password-based key derivation with tunable memory and processing costs". Journal of Cryptographic Engineering. 4 (2): 75–89. CiteSeerX   10.1.1.642.8519 . doi:10.1007/s13389-013-0063-5. ISSN   2190-8508. S2CID   5245769.
  8. "Cryptology ePrint Archive: Report 2014/030". eprint.iacr.org. Retrieved 2016-03-22.
  9. 1 2 3 Andrade, E.; Simplicio Jr, M.; Barreto, P.; Santos, P. (2016-01-01). "Lyra2: efficient password hashing with high security against time-memory trade-offs". IEEE Transactions on Computers. PP (99): 3096–3108. doi:10.1109/TC.2016.2516011. ISSN   0018-9340. S2CID   37232444.
  10. 1 2 3 Simplicio Jr, Marcos A.; Almeida, Leonardo C.; Andrade, Ewerton R.; Santos, Paulo C.; Barreto, Paulo S. L. M. "The Lyra2 reference guide" (PDF). PHC. The Password Hashing Competition.
  11. Chen, Lily (2009). "Recommendation for Key Derivation Using Pseudorandom Functions (Revised)" (PDF). Computer Security. NIST. doi: 10.6028/NIST.SP.800-108 .
  12. Percival, Colin. "Stronger Key Derivation via Sequential Memory-Hard Functions" (PDF). TARSNAP. The Technical BSD Conference.
  13. "Cryptology ePrint Archive: Report 2013/525". eprint.iacr.org. Retrieved 2016-03-22.
  14. Schmidt, Sascha. "Implementation of the Catena Password-Scrambling Framework" (PDF). Bauhaus-Universität Weimar. Faculty of Media.
  15. "P-H-C/phc-winner-argon2" (PDF). GitHub. Retrieved 2016-03-22.
  16. 1 2 "Gmane -- Another PHC candidates mechanical tests". article.gmane.org. Retrieved 2016-03-22.
  17. 1 2 "Gmane -- A review per day Lyra2". article.gmane.org. Retrieved 2016-03-22.
  18. 1 2 "Gmane -- Lyra2 initial review". article.gmane.org. Retrieved 2016-03-22.
  19. 1 2 "Gmane -- Memory performance and ASIC attacks". article.gmane.org. Retrieved 2016-03-22.
  20. 1 2 "Gmane -- Quick analysis of Argon". article.gmane.org. Retrieved 2016-03-22.