<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Yescrypt</id>
	<title>Yescrypt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Yescrypt"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Yescrypt&amp;action=history"/>
	<updated>2026-05-15T09:11:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=Yescrypt&amp;diff=1980&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;{{#seo: |title=Yescrypt – Miner, Review of algorithm, AMD, NVIDIA – zaoniao Wiki |keywords=Yescrypt, miner, algorithm, Nvidia, AMD, mining, GPU, CPU |description=Yescrypt...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Yescrypt&amp;diff=1980&amp;oldid=prev"/>
		<updated>2019-03-13T04:01:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{#seo: |title=Yescrypt – Miner, Review of algorithm, AMD, NVIDIA – zaoniao Wiki |keywords=Yescrypt, miner, algorithm, Nvidia, AMD, mining, GPU, CPU |description=Yescrypt...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{#seo:&lt;br /&gt;
|title=Yescrypt – Miner, Review of algorithm, AMD, NVIDIA – zaoniao Wiki&lt;br /&gt;
|keywords=Yescrypt, miner, algorithm, Nvidia, AMD, mining, GPU, CPU&lt;br /&gt;
|description=Yescrypt is a password-based key derivation function. Yescrypt applies slow cryptographic operations to a password and salt, creating a key suitable for performing encryption or storage. Review of Yescrypt miners for Nvidia and AMD GPU.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;amp/&amp;gt;&lt;br /&gt;
[[File:yescrypt1.png|410px|right|Yescrypt miner]]&lt;br /&gt;
'''Yescrypt''' is a password-based key derivation function. It applies slow cryptographic operations to a password and salt, creating a key suitable for performing encryption or storage to validate the password in the future. Yescrypt algorithm is based on scrypt by Colin Percival of Tarsnap.&lt;br /&gt;
&lt;br /&gt;
==Yescrypt parameters==&lt;br /&gt;
The yescrypt algorithm accepts the following parameters:&lt;br /&gt;
* Password – The password from which to derive the key.&lt;br /&gt;
* Salt – A random string that is unique to this password.&lt;br /&gt;
* N – Increasing N increases running time and memory use.&lt;br /&gt;
* R – Increasing R increases the size of the blocks operated on by the algorithm (and thus increases memory use).&lt;br /&gt;
* P – Parallelism factor.&lt;br /&gt;
* T – Increasing T increases running time without increasing memory use.&lt;br /&gt;
* G – The number of times the [[hash]] has been &amp;quot;upgraded.&amp;quot; This is  used for strengthening stored password hashes without requiring knowledge of the original password.&lt;br /&gt;
* Flags – Flags enabling/disabling yescrypt features.&lt;br /&gt;
* [ROM] – Read-only memory that the resulting key will be made to depend on.&lt;br /&gt;
* DKLen – The length of key to derive (output).&lt;br /&gt;
Upon completion, yescrypt returns an array of DKLen bytes, which is a key derived from the Password and Salt according to the other parameters.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters must be of the following types and must conform to the following restrictions.&lt;br /&gt;
* Password – A byte array of arbitrary length.&lt;br /&gt;
* Salt – A byte array of arbitrary length.&lt;br /&gt;
* N – An integer power of two, strictly greater than 1.&lt;br /&gt;
* R – An integer strictly greater than zero.&lt;br /&gt;
* P – An integer strictly greater than zero.&lt;br /&gt;
* T – An integer greater than or equal to zero.&lt;br /&gt;
* G – An integer greater than or equal to zero.&lt;br /&gt;
* Flags – Valid flags are: YESCRYPT_RW, YESCRYPT_WORM, and YESCRYPT_PREHASH. Each flag can either be set or not set.&lt;br /&gt;
* [ROM] – An array of NROM blocks (a block is defined below), where NROM is a power of two strictly greater than 1. Read-only  memory supporting fast random access. Optional. Maybe  NULL.&lt;br /&gt;
&lt;br /&gt;
The YESCRYPT_RW and YESCRYPT_WORM flags may not be set at the same time. T may only be non-zero when either the YESCRYPT_RW flag or the YESCRYPT_WORM flag is set. When the YESCRYPT_RW flag is set, floor(N/p) must be strictly greater than 1. &lt;br /&gt;
&lt;br /&gt;
When no flags are set, T = 0, G = 0, and no ROM is given, Yescrypt is equivalent to classic scrypt.&lt;br /&gt;
[[File:yescrypt.jpg|550px|right|Yescrypt miner]]&lt;br /&gt;
In actual implementations of yescrypt, there will be further restrictions to these parameters. Values computed from them may overflow the integer type used to store the result. It is up to the programmer to determine these limitations and check for them, as they are platform-dependant. The integerify() function is specified to return a 64-bit value. This value is then &amp;quot;wrapped&amp;quot; according to a value computed from these parameters. If the wrap limit is more than 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;, then yescrypt is no longer [[Security|secure]]. It is left to the programmer to check for this case.&lt;br /&gt;
&lt;br /&gt;
==Constants in Yescrypt==&lt;br /&gt;
The Yescrypt algorithm depends on several constants. These constants are not parameters to the algorithm. They are fixed at compile-time, and it is recommended to use the default values as specified here. The configurable constants may be changed independently. The derived constants are computed from the configurable constants.&lt;br /&gt;
&lt;br /&gt;
===Configurable Constants===&lt;br /&gt;
    PWXSIMPLE = 2&lt;br /&gt;
    PWXGATHER = 4&lt;br /&gt;
    PWXROUNDS = 6&lt;br /&gt;
    SWIDTH = 8&lt;br /&gt;
&lt;br /&gt;
===Derived Constants===&lt;br /&gt;
The derived constants are derived from the configurable constants.&lt;br /&gt;
    PWXBYTES = PWXGATHER * PWXSIMPLE * 8&lt;br /&gt;
    PWXWORDS = PWXBYTES / 4&lt;br /&gt;
    SBYTES = 3 * (2^SWIDTH) * PWXSIMPLE * 8&lt;br /&gt;
    SWORDS = SBYTES / 4&lt;br /&gt;
    SMASK = ((2^SWIDTH) - 1) * PWXSIMPLE * 8&lt;br /&gt;
    RMIN = (PWXBYTES + 127) / 128&lt;br /&gt;
&lt;br /&gt;
==Data Types of Yescrypt algorithm==&lt;br /&gt;
Yescrypt operates on arrays of 32-bit unsigned integers. Yescrypt operates on groups of words at a time, so it is useful to define terminology for the sizes of these groups. A &amp;quot;cell&amp;quot; will refer to an array of 16 words. A &amp;quot;block&amp;quot; will refer to an array of 2*R cells, where R is a yescrypt parameter as defined above.&lt;br /&gt;
&lt;br /&gt;
For example, if B is a block, then B[0] will refer to the first cell in the block, and B[1] will refer to the second cell in the block. B[0][0] will refer to the first word in the first cell of B, and B[0][1] will refer to he second word in the first cell of B. Yescrypt uses a data structure called an Sbox. An sbox is an array S of SWORDS words with three pointers (equivalently, indices) into it, called S0, S1, and S2, and an integer w. When initialized, S2 points to the beginning of S, S1 points a third of the way into S (index SWORDS / 3), and S0 points two-thirds of the way into S (index 2 * SWORDS / 3). Whenever a block or cell needs to be interpreted as a byte array, the words should be encoded in little-endian byte order.&lt;br /&gt;
&lt;br /&gt;
Whenever necessary, we assume integer parameters and loop counters are contained in 64-bit unsigned integers. Overflow checks have been omitted from the psuedocode in this document, but are necessary in real implementations.&lt;br /&gt;
&lt;br /&gt;
==Functions==&lt;br /&gt;
For each function, developers specify the input parameters and precondition constraints they must satisfy. They also specify the output and the properties it should satisfy given that the preconditions were satisfied. Note that some of the functions return values by modifying one of their input parameters. The functions' actions are specified in pseudocode.&lt;br /&gt;
&lt;br /&gt;
===yescrypt_kdf===&lt;br /&gt;
    Input (See Section 2 for explanations and constraints):&lt;br /&gt;
        Password&lt;br /&gt;
        Salt&lt;br /&gt;
        N&lt;br /&gt;
        R&lt;br /&gt;
        P&lt;br /&gt;
        T&lt;br /&gt;
        G&lt;br /&gt;
        Flags&lt;br /&gt;
        [ROM]&lt;br /&gt;
        DKLen&lt;br /&gt;
    Output:&lt;br /&gt;
        DK          - A key derived from the password and salt according to the other parameters.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
        - See Section 2.&lt;br /&gt;
    Steps:&lt;br /&gt;
        if&lt;br /&gt;
            YESCRYPT_RW flag is set AND&lt;br /&gt;
            P &amp;gt;= 1 AND&lt;br /&gt;
            N/P &amp;gt;= 0x100 AND&lt;br /&gt;
            (N/P) * R &amp;gt;= 0x20000&lt;br /&gt;
        then&lt;br /&gt;
            Password = yescrypt(&lt;br /&gt;
                Password,&lt;br /&gt;
                Salt,&lt;br /&gt;
                N / 2^6,&lt;br /&gt;
                R,&lt;br /&gt;
                P,&lt;br /&gt;
                0,&lt;br /&gt;
                0,&lt;br /&gt;
                Flags | YESCRYPT_PREHASH,&lt;br /&gt;
                32&lt;br /&gt;
            )&lt;br /&gt;
        end if&lt;br /&gt;
        for i = 0 to g - 1 do&lt;br /&gt;
           Password = yescrypt_kdf_body(Password, Salt, N, R, P, T, Flags, 32)&lt;br /&gt;
            N = N * 4&lt;br /&gt;
            T = floor(T / 2)&lt;br /&gt;
        end&lt;br /&gt;
        Password = yescrypt_kdf_body(Password, Salt, N, R, P, T, Flags, DKLen)&lt;br /&gt;
        return Password&lt;br /&gt;
&lt;br /&gt;
===yescrypt_kdf_body===&lt;br /&gt;
    Input (See Section 2 for explanations and constraints):&lt;br /&gt;
        Password&lt;br /&gt;
        Salt&lt;br /&gt;
        N&lt;br /&gt;
        R&lt;br /&gt;
        P&lt;br /&gt;
        T&lt;br /&gt;
        Flags&lt;br /&gt;
        [ROM]&lt;br /&gt;
        DKLen&lt;br /&gt;
    Output:&lt;br /&gt;
        DK          - A key derived from the password and salt according to the&lt;br /&gt;
                      other parameters.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
        - See Section 2.&lt;br /&gt;
    Steps:&lt;br /&gt;
        if YESCRYPT_PREHASH flag is set then&lt;br /&gt;
            Password = HMAC-SHA256(Password, &amp;quot;yescrypt-prehash&amp;quot;)&lt;br /&gt;
        else if YESCRYPT_RW flag is set OR YESCRYPT_WORM flag is set&lt;br /&gt;
            Password = HMAC-SHA256(Password, &amp;quot;yescrypt&amp;quot;)&lt;br /&gt;
        end if&lt;br /&gt;
&lt;br /&gt;
        B[0], B[1], ..., B[P-1] = PBKDF2-SHA256(Password, Salt, 1, P * 128 * R)&lt;br /&gt;
&lt;br /&gt;
        if any of the YESCRYPT_RW, YESCRYPT_WORM, or YESCRYPT_PREHASH flags are set&lt;br /&gt;
            Password = The first 32 bytes of B[0]&lt;br /&gt;
        end if&lt;br /&gt;
&lt;br /&gt;
        if YESCRYPT_RW flag is set then&lt;br /&gt;
            sMix(N, R, T, P, B, Flags, ROM, Password)&lt;br /&gt;
        else&lt;br /&gt;
            for i = 0 to P - 1 do&lt;br /&gt;
                sMix(N, R, T, 1, B[i], Flags, ROM, Password)&lt;br /&gt;
            end&lt;br /&gt;
        end if&lt;br /&gt;
        Result = PBKDF2-SHA256(Password, B, 1, max(DKLen, 32))&lt;br /&gt;
        if&lt;br /&gt;
            (YESCRYPT_RW flag is set OR YESCRYPT_WORM flag is set) AND&lt;br /&gt;
            YESCRYPT_PREHASH flag is *not* set&lt;br /&gt;
        then&lt;br /&gt;
            ClientValue = First 32 bytes of Result&lt;br /&gt;
            ClientKey = HMAC-SHA256(&amp;quot;Client Key&amp;quot;, ClientValue)&lt;br /&gt;
            StoredKey = SHA256(ClientKey)&lt;br /&gt;
            Set the first 32 bytes of Result to the StoredKey&lt;br /&gt;
        end if&lt;br /&gt;
        return the first dkLen bytes of Result&lt;br /&gt;
&lt;br /&gt;
===sMix===&lt;br /&gt;
    Input:&lt;br /&gt;
        N       - An integer power of two strictly greater than one.&lt;br /&gt;
        R       - An integer strictly greater than zero.&lt;br /&gt;
        T       - An integer greater than or equal to zero.&lt;br /&gt;
        P       - An integer strictly greater than zero.&lt;br /&gt;
        Blocks  - An array of P blocks.&lt;br /&gt;
        Flags   - Valid flags are: YESCRYPT_RW, YESCRYPT_WORM, and YESCRYPT_PREHASH. Each flag can either be set or not set.&lt;br /&gt;
        [ROM]   - An array of NROM blocks, where NROM is a power of two. May be NULL.&lt;br /&gt;
        sha256  - An array of 32 bytes.&lt;br /&gt;
    Output:&lt;br /&gt;
        The Blocks and sha256 parameters are modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        Allocate P Sboxes SBox[0], SBox[1], ..., SBox[P - 1].&lt;br /&gt;
        n = N / P&lt;br /&gt;
        Nloop_all = fNloop(n, T, Flags)&lt;br /&gt;
        if YESCRYPT_RW flag is set&lt;br /&gt;
            NLoop_rw = Nloop_all / P&lt;br /&gt;
        else&lt;br /&gt;
            NLoop_rw = 0&lt;br /&gt;
        end&lt;br /&gt;
        n = n - (n % 2)&lt;br /&gt;
        Nloop_all = Nloop_all + (Nloop_all % 2)&lt;br /&gt;
        Nloop_rw = Nloop_rw + (Nloop_rw % 2)&lt;br /&gt;
        Allocate N blocks V[0], V[1], ..., V[N-1]&lt;br /&gt;
        for i = 0 to p - 1 do&lt;br /&gt;
            v = i * n&lt;br /&gt;
            if i == p - 1 do&lt;br /&gt;
                n = N - v&lt;br /&gt;
            end if&lt;br /&gt;
            w = v + n - 1&lt;br /&gt;
            if YESCRYPT_RW flag is set&lt;br /&gt;
                # Note: This call modifies the first two cells of Blocks[i], and&lt;br /&gt;
                # that modification must be saved.&lt;br /&gt;
                sMix1(1, First two cells of Blocks[i], SBYTES/128, SBox[i].S, Flags without YESCRYPT_RW, NULL, ROM)&lt;br /&gt;
                if i == 0 do&lt;br /&gt;
                    sha255 = HMAC-SHA256(Blocks[i][2*r - 1], SHA256)&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                SBox[i] = NULL&lt;br /&gt;
            end if&lt;br /&gt;
            sMix1(R, Blocks[i], n, V[v..w], Flags, SBox[i], ROM)&lt;br /&gt;
            sMix2(R, Blocks[i], p2floor(n), Nloop_rw, V[v..w], Flags, SBox[i], ROM)&lt;br /&gt;
        end for&lt;br /&gt;
        for i = 0 to p - 1 do&lt;br /&gt;
            sMix2(R, Blocks[i], N, Nloop_all - Nloop_rw, V, flags without YESCRYPT_RW, SBox[i], ROM)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
===sMix1===&lt;br /&gt;
    Input:&lt;br /&gt;
        R               - An integer strictly greater than zero.&lt;br /&gt;
        Block           - A block.&lt;br /&gt;
        N               - An integer strictly greater than zero.&lt;br /&gt;
        OutputBlocks    - An array of N blocks.&lt;br /&gt;
        Flags           - Valid flags are: YESCRYPT_RW, YESCRYPT_WORM, and YESCRYPT_PREHASH. Each flag can either be set or not set.&lt;br /&gt;
        [SBox]          - Either NULL or an sbox.&lt;br /&gt;
        [ROM]           - An array of NROM blocks, where NROM is a power of two. May be NULL.&lt;br /&gt;
    Output:&lt;br /&gt;
        The Block and OutputBlocks parameters are modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        SIMDShuffle(Block)&lt;br /&gt;
        for i = 0 to N - 1 do&lt;br /&gt;
            OutputBlocks[i] = Block&lt;br /&gt;
            if (ROM is not NULL) AND (i % 2 != 0)&lt;br /&gt;
                j = integerify(R, Block) % NROM&lt;br /&gt;
                Block = Block XOR ROM[j]&lt;br /&gt;
            else if YESCRYPT_RW flag is set AND i &amp;gt; 1&lt;br /&gt;
                j = wrap(integerify(R, Block), i)&lt;br /&gt;
                Block = Block XOR OutputBlocks[j]&lt;br /&gt;
            end if&lt;br /&gt;
            if SBox is NULL&lt;br /&gt;
                blockmix_salsa8(R, Block)&lt;br /&gt;
            else&lt;br /&gt;
                blockmix_pwxform(R, Block, SBox)&lt;br /&gt;
            end if&lt;br /&gt;
        end for&lt;br /&gt;
        SIMDUnshuffle(Block)&lt;br /&gt;
&lt;br /&gt;
===sMix2===&lt;br /&gt;
    Input:&lt;br /&gt;
        R               - An integer strictly greater than zero.&lt;br /&gt;
        Block           - A block.&lt;br /&gt;
        N               - An integer power of two strictly greater than 1.&lt;br /&gt;
        Nloop           - An integer greater than or equal to zero.&lt;br /&gt;
        OutputBlocks    - An array of N blocks.&lt;br /&gt;
        Flags           - Valid flags are: YESCRYPT_RW, YESCRYPT_WORM, and  YESCRYPT_PREHASH. Each flag can either be set or not   set.&lt;br /&gt;
        [Sbox]          - Either NULL or an sbox.&lt;br /&gt;
        [ROM]           - An array of NROM blocks, where NROM is a power of two.&lt;br /&gt;
                          May be NULL.&lt;br /&gt;
    Output:&lt;br /&gt;
        The Block and OutputBlocks parameters are modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        SIMDShuffle(Block)&lt;br /&gt;
        for i = 0 to NLoop - 1 do&lt;br /&gt;
            if (ROM is not NULL) AND (i % 2 != 0)&lt;br /&gt;
                j = integerify(R, Block) % NROM&lt;br /&gt;
                Block = Block XOR ROM[j]&lt;br /&gt;
            else&lt;br /&gt;
                j = integerify(R, Block) % N&lt;br /&gt;
                Block = Block XOR OutputBlocks[j]&lt;br /&gt;
                if YESCRYPT_RW flag is set&lt;br /&gt;
                    OutputBlocks[j] = Block&lt;br /&gt;
                end if&lt;br /&gt;
            end if&lt;br /&gt;
            if SBox is NULL&lt;br /&gt;
                blockmix_salsa8(R, Block)&lt;br /&gt;
            else&lt;br /&gt;
                blockmix_pwxform(R, Block, SBox)&lt;br /&gt;
            end if&lt;br /&gt;
        end for&lt;br /&gt;
        SIMDUnshufle(Block)&lt;br /&gt;
&lt;br /&gt;
===blockmix_pwxform===&lt;br /&gt;
    Input:&lt;br /&gt;
        R           - An integer strictly greater than zero.&lt;br /&gt;
        Block       - A block.&lt;br /&gt;
        Sbox        - An sbox (may not be NULL)&lt;br /&gt;
    Output:&lt;br /&gt;
        The Block parameter is modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        pwx_blocks = floor(2 * R * 16 / PWXWORDS)&lt;br /&gt;
        # Pretend &amp;quot;cells&amp;quot; are now made up of PWXWORDs words, instead of 16.&lt;br /&gt;
        PWXB = View Block as PWXB[0], PWXB[1], ..., PWXB[pwx_blocks - 1] chunks&lt;br /&gt;
               of size PWXWORDS.&lt;br /&gt;
        X = PWXB[pwx_blocks - 1]&lt;br /&gt;
        for i = 0 to pwx_blocks - 1 do&lt;br /&gt;
            if pwx_blocks &amp;gt; 1&lt;br /&gt;
                X = X XOR PWXB[i]&lt;br /&gt;
            end&lt;br /&gt;
            pwxform(X)&lt;br /&gt;
            PWXB[i] = X&lt;br /&gt;
        end for&lt;br /&gt;
        # Go back to thinking of cells as 16 words.&lt;br /&gt;
        i = (pwx_blocks - 1) * PWXWORDS / 16&lt;br /&gt;
        salsa20_r(Block[i], 2)&lt;br /&gt;
        for i = i + 1 to 2 * r - 1 do&lt;br /&gt;
            # ''Check this... I think this is right, and actually simpler.''&lt;br /&gt;
            # (If it is, we don't need that extra array in the Ruby impl.)&lt;br /&gt;
            Block[i] = Block[i - 1] XOR Block[i]&lt;br /&gt;
            salsa20_r(Block[i], 2)&lt;br /&gt;
        end for&lt;br /&gt;
&lt;br /&gt;
===pwxform===&lt;br /&gt;
    Input:&lt;br /&gt;
        PWXBlock    - An array of PWXWORDS words.&lt;br /&gt;
        Sbox        - An sbox (may not be NULL).&lt;br /&gt;
    Output:&lt;br /&gt;
        The PWXBlock parameter is modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        S0 = Sbox.S0&lt;br /&gt;
        S1 = Sbox.S1&lt;br /&gt;
        S2 = Sbox.S2&lt;br /&gt;
        for i = 0 to PWXROUNDS - 1 do&lt;br /&gt;
            for j = 0 to PWXGATHER - 1 do&lt;br /&gt;
                x_lo = PWXBlock[2 * j * PWXSIMPLE]&lt;br /&gt;
                x_hi = PWXBlock[2 * j * PWXSIMPLE + 1]&lt;br /&gt;
                p0 = (x_lo &amp;amp; SMASK) / (PWXSIMPLE * 8)&lt;br /&gt;
                p1 = (x_hi &amp;amp; SMASK) / (PWXSIMPLE * 8)&lt;br /&gt;
                for k = 0 to PWXSIMPLE - 1 do&lt;br /&gt;
                    lo = PWXBlock[2 * (j * PWXSIMPLE + k)]&lt;br /&gt;
                    hi = PWXBlock[2 * (j * PWXSIMPLE + k) + 1]&lt;br /&gt;
                    s0 = Sbox.S[S0 + 2 * (p0 * PWXSIMPLE + k)] + (Sbox.S[S0 + 2 * (p0 + PWXSIMPLE + k) + 1] * 2^32)&lt;br /&gt;
                    s1 = Sbox.S[S1 + 2 * (p1 * PWXSIMPLE + k)] + (Sbox.S[S1 + 2 * (p1 * PWXSIMPLE + k) + 1] * 2^32)&lt;br /&gt;
                    result = (((hi * lo) + s0) XOR s1) % 2^64&lt;br /&gt;
                    PWXBlock[2 * (j * PWXSIMPLE + k)] = result % 2^32&lt;br /&gt;
                    PWXBlock[2 * (j * PWXSIMPLE + k)] = floor(result / 2^32)&lt;br /&gt;
                    if i != 0 &amp;amp;&amp;amp; i != PWXROUNDS - 1 do&lt;br /&gt;
                        Sbox.S[S2 + 2 * Sbox.w] = result % 2^32&lt;br /&gt;
                        Sbox.S[S2 + 2 * Sbox.w + 1] = floor(result / 2^32)&lt;br /&gt;
                        Sbox.w = Sbox.w + 1&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end for&lt;br /&gt;
        end for&lt;br /&gt;
        Sbox.S0 = S2&lt;br /&gt;
        Sbox.S1 = S0&lt;br /&gt;
        Sbox.S2 = S1&lt;br /&gt;
        sbox.w = sbox.w &amp;amp; (SMASK / 8)&lt;br /&gt;
&lt;br /&gt;
===blockmix_salsa8===&lt;br /&gt;
    Input:&lt;br /&gt;
        R           - An integer strictly greater than zero.&lt;br /&gt;
        Block       - A block.&lt;br /&gt;
    Output:&lt;br /&gt;
        The Block parameter is modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        X = Block[2 * r - 1]&lt;br /&gt;
        Allocate a block Y.&lt;br /&gt;
        for i = 0 to 2 * r - 1 do&lt;br /&gt;
            X = X XOR Block[i]&lt;br /&gt;
            salsa20_r(X, 8)&lt;br /&gt;
            if i % 2 == 0&lt;br /&gt;
                Y[i/2] = X&lt;br /&gt;
            else&lt;br /&gt;
                Y[r + (i-1)/2] = X&lt;br /&gt;
            end&lt;br /&gt;
        end for&lt;br /&gt;
        Block = Y&lt;br /&gt;
&lt;br /&gt;
===salsa20_r===&lt;br /&gt;
    Input:&lt;br /&gt;
        Cell - A cell.&lt;br /&gt;
        r    - Number of rounds.&lt;br /&gt;
    Output:&lt;br /&gt;
        The Words parameter is modified in-place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        This is the Salsa20 core reduced to r rounds with a SIMD unshuffle (like&lt;br /&gt;
        SIMDUnshuffle) pre-applied and a SIMD shuffle (like SIMDShuffle)&lt;br /&gt;
        post-applied. See [7] for more information.&lt;br /&gt;
        ''specify the shuffling completely here''&lt;br /&gt;
===fNloop===&lt;br /&gt;
&lt;br /&gt;
    Input:&lt;br /&gt;
        N           - An integer strictly greater than zero.&lt;br /&gt;
        T           - An integer greater than or equal to zero.&lt;br /&gt;
        Flags       - Valid flags are: YESCRYPT_RW, YESCRYPT_WORM, and&lt;br /&gt;
                      YESCRYPT_PREHASH. Each flag can either be set or not set.&lt;br /&gt;
    Output:&lt;br /&gt;
        Returns a positive integer.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        The result is defined according to this table:&lt;br /&gt;
        +------+-----------------+-----------------+-----------+&lt;br /&gt;
        |      | Nloop           |                 |           |&lt;br /&gt;
        | t    | YESCRYPT_RW     | YESCRYPT_WORM   | Otherwise |&lt;br /&gt;
        +------+-----------------+-----------------+-----------+&lt;br /&gt;
        | 0    | (N+2)/3         | N               | N         |&lt;br /&gt;
        | 1    | (2N + 2) / 3    | N + (N + 1) / 2 | N         |&lt;br /&gt;
        | &amp;gt; 1  | (t - 1)*N       | t*N             | N         |&lt;br /&gt;
        +------+-----------------+-----------------+-----------+&lt;br /&gt;
&lt;br /&gt;
===p2floor===&lt;br /&gt;
    Input:&lt;br /&gt;
        X           - An integer strictly greater than 0.&lt;br /&gt;
    Output:&lt;br /&gt;
        Returns the greatest power of two less than or equal to X.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        y = X &amp;amp; (X - 1)&lt;br /&gt;
        while y != 0&lt;br /&gt;
            X = y&lt;br /&gt;
            y = X &amp;amp; (X - 1)&lt;br /&gt;
        end while&lt;br /&gt;
        return X&lt;br /&gt;
&lt;br /&gt;
===Yescrypt – wrap===&lt;br /&gt;
    Input:&lt;br /&gt;
        X           - An integer greater than or equal to zero.&lt;br /&gt;
        L           - An integer strictly greater than zero.&lt;br /&gt;
    Output:&lt;br /&gt;
        Returns an integer in the range 0 to L-1 (inclusive).&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        n = p2floor(X)&lt;br /&gt;
        return (X % n) + (L - n)&lt;br /&gt;
&lt;br /&gt;
===integerify===&lt;br /&gt;
    Input:&lt;br /&gt;
        R           - An integer strictly greater than zero.&lt;br /&gt;
        Block       - A block.&lt;br /&gt;
    Output:&lt;br /&gt;
        Returns an integer. A 64-bit value derived from Block.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        return B[2*R - 1][0] + (B[2*R - 1][13] * 2^32)&lt;br /&gt;
&lt;br /&gt;
===SIMDShuffle===&lt;br /&gt;
    Input:&lt;br /&gt;
        R           - An integer strictly greater than zero.&lt;br /&gt;
        Block       - A block.&lt;br /&gt;
    Output:&lt;br /&gt;
        Block is shuffled in place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        for i = 0 to 2*R - 1 do&lt;br /&gt;
            Saved = Block[i]&lt;br /&gt;
            for k = 0 to 15 do&lt;br /&gt;
                Block[i][k] = Saved[(k * 5) % 16]&lt;br /&gt;
            end&lt;br /&gt;
        end for&lt;br /&gt;
&lt;br /&gt;
===SIMDUnshufle===&lt;br /&gt;
    Input:&lt;br /&gt;
        R           - An integer strictly greater than zero.&lt;br /&gt;
        Block       - A block.&lt;br /&gt;
    Output:&lt;br /&gt;
        Block is unshuffled in place.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        for i = 0 to 2*R - 1 do&lt;br /&gt;
            Saved = Block[i]&lt;br /&gt;
            for k = 0 to 15 do&lt;br /&gt;
                Block[i][(k * 5) % 16] = Saved[k]&lt;br /&gt;
            end&lt;br /&gt;
        end for&lt;br /&gt;
&lt;br /&gt;
===HMAC-SHA256===&lt;br /&gt;
    Input:&lt;br /&gt;
        Key         - An arbitrary-length array of bytes.&lt;br /&gt;
        Message     - An arbitrary-length array of bytes.&lt;br /&gt;
        ''There are actual limitations coming from SHA256's input size limit.... should we be more precise?''&lt;br /&gt;
    Output:&lt;br /&gt;
        An array of 32 bytes.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        HMAC is defined in [https://tools.ietf.org/html/rfc2104 RFC2104].&lt;br /&gt;
&lt;br /&gt;
===PBKDF2-SHA256===&lt;br /&gt;
    Input:&lt;br /&gt;
        Password        - An arbitrary-length array of bytes.&lt;br /&gt;
        Salt            - An arbitrary-length array of bytes.&lt;br /&gt;
        Iterations      - An integer strictly greater than zero.&lt;br /&gt;
        DKLen           - An integer strictly greater than zero.&lt;br /&gt;
    Output:&lt;br /&gt;
        An array of DKLen bytes.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        PBKDF2 is defined in [https://tools.ietf.org/html/rfc2898 RFC2898].&lt;br /&gt;
&lt;br /&gt;
=== SHA256===&lt;br /&gt;
    Input:&lt;br /&gt;
        Message         - An arbitrary-length array of bytes.&lt;br /&gt;
    Output:&lt;br /&gt;
        An array of 32 bytes.&lt;br /&gt;
    Preconditions:&lt;br /&gt;
    Steps:&lt;br /&gt;
        [[SHA-256]] is defined in [http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf Secure Hash Standard  (SHS) – FIPS180-4].&lt;br /&gt;
&lt;br /&gt;
==Security==&lt;br /&gt;
Note that non-optimized implementations are essentially insecure, sothe implementer needs to know their platform and might need to changetheir implementation from what we implicitly assume (e.g. 32-bit integers)ю&lt;br /&gt;
&lt;br /&gt;
==Yescrypt Miner==&lt;br /&gt;
There are GPU miners for [[mining]] of Yescrypt via AMD and NVIDIA. However, at the moment these miners show less performance compared to mining Yescrypt using CPU.&lt;br /&gt;
&lt;br /&gt;
Two cryptocurrencies – Global Boot-u (BASTY) Unitas and [[TBC]] - are currently based on the Scrypt algorithm, and the ITI is an alternative cryptocurrency with multi-support algorithms. &lt;br /&gt;
&lt;br /&gt;
Results for Yescrypt performance:&lt;br /&gt;
* i7 5820K processor: 5.22 XC&lt;br /&gt;
* AMD Radeon R9 280X GPU: 0.793 kHz&lt;br /&gt;
* NVIDIA GeForce GTX 980 GPU: 1.124 kHz&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[ICO listing]]&lt;br /&gt;
* [[Cryptocurrencies popularisation]]&lt;br /&gt;
* [[E-Chat]]&lt;br /&gt;
* [[JXTA]]&lt;br /&gt;
* [[LAToken]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [https://github.com/defuse/yescrypt/blob/master/new-spec/yescrypt.txt The Yescrypt Password-Based Key Derivation Function DRAFT]&lt;br /&gt;
* [https://password-hashing.net/submissions/specs/yescrypt-v1.pdf https://password-hashing.net/submissions/specs/yescrypt-v1.pdf] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[ru:Yescrypt]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>