2 * Argon2 reference source code package - reference C implementations
5 * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
7 * You may use this work under the terms of a Creative Commons CC0 1.0
8 * License/Waiver or the Apache Public License 2.0, at your option. The terms of
9 * these licenses can be found at:
11 * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
12 * - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
14 * You should have received a copy of both of these licenses along with this
15 * software. If not, they may be obtained at the above URLs.
18 #ifndef BLAKE_ROUND_MKA_H
19 #define BLAKE_ROUND_MKA_H
22 #include "blake2-impl.h"
24 /* designed by the Lyra PHC team */
25 static BLAKE2_INLINE uint64_t fBlaMka(uint64_t x, uint64_t y) {
26 const uint64_t m = UINT64_C(0xFFFFFFFF);
27 const uint64_t xy = (x & m) * (y & m);
28 return x + y + 2 * xy;
31 #define G(a, b, c, d) \
34 d = rotr64(d ^ a, 32); \
36 b = rotr64(b ^ c, 24); \
38 d = rotr64(d ^ a, 16); \
40 b = rotr64(b ^ c, 63); \
43 #define BLAKE2_ROUND_NOMSG(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \
48 G(v2, v6, v10, v14); \
49 G(v3, v7, v11, v15); \
50 G(v0, v5, v10, v15); \
51 G(v1, v6, v11, v12); \