This commit is contained in:
Jay D Dee
2018-04-10 21:49:06 -04:00
parent 9ffce7bdb7
commit 218cef337a
7 changed files with 41 additions and 23 deletions

View File

@@ -71,6 +71,7 @@ bool register_argon2d_crds_algo( algo_gate_t* gate )
gate->hash = (void*)&argon2d_crds_hash;
gate->set_target = (void*)&scrypt_set_target;
gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT;
ARGON2_VERSION_NUMBER = ARGON2_VERSION_10;
return true;
}
@@ -140,6 +141,7 @@ bool register_argon2d_dyn_algo( algo_gate_t* gate )
gate->hash = (void*)&argon2d_dyn_hash;
gate->set_target = (void*)&scrypt_set_target;
gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT;
ARGON2_VERSION_NUMBER = ARGON2_VERSION_10;
return true;
}
@@ -189,6 +191,7 @@ bool register_argon2d4096_algo( algo_gate_t* gate )
gate->set_target = (void*)&scrypt_set_target;
gate->get_max64 = (void*)&get_max64_0x1ff;
gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT;
ARGON2_VERSION_NUMBER = ARGON2_VERSION_13;
return true;
}

View File

@@ -224,12 +224,22 @@ typedef enum Argon2_type {
Argon2_id = 2
} argon2_type;
// Version implementation sucks, needs to be changed.
// It should be set in the ctx before calling the argon2_ctx.
// It should be a function arg of *hash_raw & *hash_encoded.
// Then remove initialization from gate register function.
/* Version of the algorithm */
/*
typedef enum Argon2_version {
ARGON2_VERSION_10 = 0x10,
ARGON2_VERSION_13 = 0x13,
ARGON2_VERSION_NUMBER = ARGON2_VERSION_10
} argon2_version;
*/
#define ARGON2_VERSION_10 0x10
#define ARGON2_VERSION_13 0x13
uint32_t ARGON2_VERSION_NUMBER;
/*
* Function that gives the string representation of an argon2_type.

View File

@@ -345,15 +345,15 @@ void fill_segment(const argon2_instance_t *instance,
ref_block =
instance->memory + instance->lane_length * ref_lane + ref_index;
curr_block = instance->memory + curr_offset;
// if (ARGON2_VERSION_10 == instance->version) {
// /* version 1.2.1 and earlier: overwrite, not XOR */
// fill_block(state, ref_block, curr_block, 0);
// } else {
// if(0 == position.pass) {
if (ARGON2_VERSION_10 == instance->version) {
/* version 1.2.1 and earlier: overwrite, not XOR */
fill_block(state, ref_block, curr_block, 0);
} else {
if(0 == position.pass) {
fill_block(state, ref_block, curr_block, 0);
// } else {
// fill_block(state, ref_block, curr_block, 1);
// }
// }
} else {
fill_block(state, ref_block, curr_block, 1);
}
}
}
}