static void tv_iter(int nx, const PetscScalar *x, PetscScalar *y){ // deg: degree of polynomials // nx: some context variable from Petsc interface // x: vector with which matrix A is multiplied // y = A*x const int MAT_ENTRIES = pars -> get_int("MAT_ENTRIES"); //hard coded atm, move to parameters later const int DEG = pars -> get_int("DEG"); //const int DEG = 8; std::vector<PetscScalar> Told(MAT_ENTRIES); std::vector<PetscScalar> Tcur(MAT_ENTRIES); std::vector<PetscScalar> Tnew(MAT_ENTRIES); std::vector<PetscScalar> tmp(MAT_ENTRIES); // initialize chebyshev polynomials tv2( nx, &x[0], &Tcur[0]); equal_arrays(&x[0], &Told[0]); // if deg is 1 or less return initialised values if (DEG >=1){ // else iteratively calculate chebyshev polynomials up to deg // T_n(B) = 2*B(T_{n-1}(B))-T_{n-2}(B) for (int n = 2; n <= DEG; n++){ // store B(Tcur(Bx)) in tmp1 tv2(nx, &Tcur[0], &tmp[0]); // scale tmp1 scale_array(2., &tmp[0], &tmp[0]); //calculate new polynomial subtract_arrays(&Told[0], &tmp[0], &y[0]); // overwrite new variables equal_arrays(&Tcur[0], &Told[0]); equal_arrays(&y[0], &Tcur[0]); } } }
// find a rotation that is the combination of two other // rotations. This is used to allow us to add an overall board // rotation to an existing rotation of a sensor such as the compass // Note that this relies the set of rotations being complete. The // optional 'found' parameter is for the test suite to ensure that it is. enum Rotation rotation_combination(enum Rotation r1, enum Rotation r2, bool *found) { Vector3f tv1, tv2; enum Rotation r; tv1(1,2,3); tv1.rotate(r1); tv1.rotate(r2); for (r=ROTATION_NONE; r<ROTATION_MAX; r = (enum Rotation)((uint8_t)r+1)) { Vector3f diff; tv2(1,2,3); tv2.rotate(r); diff = tv1 - tv2; if (diff.length() < 1.0e-6f) { // we found a match if (found) { *found = true; } return r; } } // we found no matching rotation. Someone has edited the // rotations list and broken its completeness property ... if (found) { *found = false; } return ROTATION_NONE; }
bool Wall::intersect(vect2d ov1, vect2d ov2, vect2d& hit) { // Transform both points into the wall's coordinate space. vect2d tv1 (j * (ov1-v1), ~j * (ov1-v1)); vect2d tv2 (j * (ov2-v1), ~j * (ov2-v1)); double xintercept; // If both points are on the same side of the wall, the line does // not intersect. if ((tv1.y > 0) == (tv2.y > 0)) { return false; } xintercept = tv1.x - ((tv2.x - tv1.x) / (tv2.y - tv1.y)) * tv1.y; // If the x intercept is within the bounds of the wall, transform // the intersection point back to normal coordinate space and // return true. if (xintercept >= 0 && xintercept <= len) { hit = j * xintercept + v1; return true; } return false; }
int main (int, char *[]) { ACE_Time_Value tv1; ACE_Time_Value tv2 (2); ACE_Time_Value tv3 (100); ACE_Time_Value tv4 (1, 1000000); ACE_Time_Value tv5 (2); ACE_Time_Value tv6 (1, -1000000); ACE_ASSERT (tv1 == ACE_Time_Value (0)); ACE_ASSERT (tv2 < tv3); ACE_ASSERT (tv2 <= tv2); ACE_ASSERT (tv2 >= tv4); ACE_ASSERT (tv5 >= tv6); ACE_ASSERT (tv2 == ACE_Time_Value (1, 1000000)); ACE_ASSERT (tv5 == tv4); ACE_ASSERT (tv2 == tv4); ACE_ASSERT (tv1 != tv2); ACE_ASSERT (tv6 == tv1); # if defined (ACE_NDEBUG) ACE_UNUSED_ARG (tv1); ACE_UNUSED_ARG (tv2); ACE_UNUSED_ARG (tv3); ACE_UNUSED_ARG (tv4); ACE_UNUSED_ARG (tv5); ACE_UNUSED_ARG (tv6); # endif /* ACE_NDEBUG */ cout << "0,0 :\t\t" << ACE_Time_Value (0,0) << endl; cout << "-0,0 :\t\t" << ACE_Time_Value (-0,0) << endl; cout << "0,-0 :\t\t" << ACE_Time_Value (0,-0) << endl; cout << "-0,-0 :\t\t" << ACE_Time_Value (-0,-0) << endl; cout << endl; cout << "0,1 :\t\t" << ACE_Time_Value (0,1) << endl; cout << "1,0 :\t\t" << ACE_Time_Value (1,0) << endl; cout << "-1,0 :\t\t" << ACE_Time_Value (-1,0) << endl; cout << "-1,-0 :\t\t" << ACE_Time_Value (-1,-0) << endl; cout << endl; cout << "1,1 :\t\t" << ACE_Time_Value (1,1) << endl; cout << "-1,1 :\t\t" << ACE_Time_Value (-1,1) << endl; cout << "1,-1 :\t\t" << ACE_Time_Value (1,-1) << endl; cout << "-1,-1 :\t\t" << ACE_Time_Value (-1,-1) << endl; cout << endl; cout << "1,-1111111 :\t" << ACE_Time_Value (1,-1111111) << endl; cout << "1,-100000 :\t" << ACE_Time_Value (1,-100000) << endl; cout << "1,-1000000 :\t" << ACE_Time_Value (1,-1000000) << endl; cout << "-1,1000000 :\t" << ACE_Time_Value (-1,1000000) << endl; cout << "5,-1000000 :\t" << ACE_Time_Value (5,-1000000) << endl; cout << "5,-1500000 :\t" << ACE_Time_Value (5,-1500000) << endl; cout << "2,-2500000 :\t" << ACE_Time_Value (2,-2500000) << endl; cout << "2,-4500000 :\t" << ACE_Time_Value (2,-4500000) << endl; return 0; }
int main(void) { tv(); tv2(); tv3(); str_tests(); assert(crypto_pwhash_argon2i_bytes_min() > 0U); assert(crypto_pwhash_argon2i_bytes_max() > crypto_pwhash_argon2i_bytes_min()); assert(crypto_pwhash_argon2i_passwd_max() > crypto_pwhash_argon2i_passwd_min()); assert(crypto_pwhash_argon2i_saltbytes() > 0U); assert(crypto_pwhash_argon2i_strbytes() > 1U); assert(crypto_pwhash_argon2i_strbytes() > strlen(crypto_pwhash_argon2i_strprefix())); assert(crypto_pwhash_argon2i_opslimit_min() > 0U); assert(crypto_pwhash_argon2i_opslimit_max() > 0U); assert(crypto_pwhash_argon2i_memlimit_min() > 0U); assert(crypto_pwhash_argon2i_memlimit_max() > 0U); assert(crypto_pwhash_argon2i_opslimit_interactive() > 0U); assert(crypto_pwhash_argon2i_memlimit_interactive() > 0U); assert(crypto_pwhash_argon2i_opslimit_moderate() > 0U); assert(crypto_pwhash_argon2i_memlimit_moderate() > 0U); assert(crypto_pwhash_argon2i_opslimit_sensitive() > 0U); assert(crypto_pwhash_argon2i_memlimit_sensitive() > 0U); assert(crypto_pwhash_argon2i_bytes_min() == crypto_pwhash_argon2i_BYTES_MIN); assert(crypto_pwhash_argon2i_bytes_max() == crypto_pwhash_argon2i_BYTES_MAX); assert(crypto_pwhash_argon2i_passwd_min() == crypto_pwhash_argon2i_PASSWD_MIN); assert(crypto_pwhash_argon2i_passwd_max() == crypto_pwhash_argon2i_PASSWD_MAX); assert(crypto_pwhash_argon2i_saltbytes() == crypto_pwhash_argon2i_SALTBYTES); assert(crypto_pwhash_argon2i_strbytes() == crypto_pwhash_argon2i_STRBYTES); assert(crypto_pwhash_argon2i_opslimit_min() == crypto_pwhash_argon2i_OPSLIMIT_MIN); assert(crypto_pwhash_argon2i_opslimit_max() == crypto_pwhash_argon2i_OPSLIMIT_MAX); assert(crypto_pwhash_argon2i_memlimit_min() == crypto_pwhash_argon2i_MEMLIMIT_MIN); assert(crypto_pwhash_argon2i_memlimit_max() == crypto_pwhash_argon2i_MEMLIMIT_MAX); assert(crypto_pwhash_argon2i_opslimit_interactive() == crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE); assert(crypto_pwhash_argon2i_memlimit_interactive() == crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE); assert(crypto_pwhash_argon2i_opslimit_moderate() == crypto_pwhash_argon2i_OPSLIMIT_MODERATE); assert(crypto_pwhash_argon2i_memlimit_moderate() == crypto_pwhash_argon2i_MEMLIMIT_MODERATE); assert(crypto_pwhash_argon2i_opslimit_sensitive() == crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE); assert(crypto_pwhash_argon2i_memlimit_sensitive() == crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE); assert(crypto_pwhash_argon2i_alg_argon2i13() == crypto_pwhash_argon2i_ALG_ARGON2I13); printf("OK\n"); return 0; }
int main(void) { char *str_out; char *str_out2; char *salt; const char *passwd = "Correct Horse Battery Staple"; tv(); tv2(); salt = (char *) sodium_malloc(crypto_pwhash_SALTBYTES); str_out = (char *) sodium_malloc(crypto_pwhash_STRBYTES); str_out2 = (char *) sodium_malloc(crypto_pwhash_STRBYTES); memcpy(salt, ">A 16-bytes salt", crypto_pwhash_SALTBYTES); if (crypto_pwhash_str(str_out, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str failure\n"); } if (crypto_pwhash_str(str_out2, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str(2) failure\n"); } if (strcmp(str_out, str_out2) == 0) { printf("pwhash_str doesn't generate different salts\n"); } if (crypto_pwhash_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } if (crypto_pwhash_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } str_out[14]++; if (crypto_pwhash_str_verify(str_out, passwd, strlen(passwd)) == 0) { printf("pwhash_str_verify(2) failure\n"); } str_out[14]--; assert(str_out[crypto_pwhash_STRBYTES - 1U] == 0); assert(crypto_pwhash_saltbytes() > 0U); assert(crypto_pwhash_strbytes() > 1U); assert(crypto_pwhash_strbytes() > strlen(crypto_pwhash_strprefix())); assert(crypto_pwhash_opslimit_interactive() > 0U); assert(crypto_pwhash_memlimit_interactive() > 0U); assert(crypto_pwhash_opslimit_moderate() > 0U); assert(crypto_pwhash_memlimit_moderate() > 0U); assert(crypto_pwhash_opslimit_sensitive() > 0U); assert(crypto_pwhash_memlimit_sensitive() > 0U); sodium_free(salt); sodium_free(str_out); sodium_free(str_out2); printf("OK\n"); return 0; }
void HalfEdgeSelector_Radiance<PFP>::updateAfterCollapse(Dart d2, Dart dd2) { MAP& m = this->m_map ; Dart stop = m.phi2(m.phi_1(d2)); recomputeQuadric(d2); Dart it = dd2; do { recomputeQuadric(m.phi1(it)); it = m.phi2(m.phi_1(it)); } while (it != stop); DartMarkerStore<MAP> dm(m); Traversor2VVaE<MAP> tv(m, d2); for (Dart v = tv.begin() ; v != tv.end() ; v = tv.next()) { dm.mark(v); updateHalfEdgeInfo(v, true); } it = dd2; do { Traversor2VVaE<MAP> tv2(m, m.phi1(it)); for (Dart v = tv2.begin() ; v != tv2.end() ; v = tv2.next()) { dm.mark(v); updateHalfEdgeInfo(v, true); } it = m.phi2(m.phi_1(it)); } while (it != stop); Traversor2VE<MAP> te(m, d2); for (Dart v = te.begin() ; v != te.end() ; v = te.next()) { if (!dm.isMarked(v)) updateHalfEdgeInfo(v, false); } it = dd2; do { Traversor2VE<MAP> te2(m, m.phi1(it)); for (Dart v = te2.begin() ; v != te2.end() ; v = te2.next()) { if (!dm.isMarked(v)) updateHalfEdgeInfo(v, false); } it = m.phi2(m.phi_1(it)); } while (it != stop); cur = halfEdges.begin() ; // set the current edge to the first one }
int main(void) { char str_out[crypto_pwhash_scryptsalsa208sha256_STRBYTES]; char str_out2[crypto_pwhash_scryptsalsa208sha256_STRBYTES]; unsigned char out[OUT_LEN]; char out_hex[OUT_LEN * 2 + 1]; const char *salt = "[<~A 32-bytes salt for scrypt~>]"; const char *passwd = "Correct Horse Battery Staple"; size_t i; tv(); tv2(); tv3(); if (crypto_pwhash_scryptsalsa208sha256_str(str_out, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str failure\n"); } if (crypto_pwhash_scryptsalsa208sha256_str(str_out2, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_str(2) failure\n"); } if (strcmp(str_out, str_out2) == 0) { printf("pwhash_str doesn't generate different salts\n"); } if (crypto_pwhash_scryptsalsa208sha256_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } if (crypto_pwhash_scryptsalsa208sha256_str_verify(str_out, passwd, strlen(passwd)) != 0) { printf("pwhash_str_verify failure\n"); } str_out[14]++; if (crypto_pwhash_scryptsalsa208sha256_str_verify( str_out, passwd, strlen(passwd)) == 0) { printf("pwhash_str_verify(2) failure\n"); } str_out[14]--; assert(crypto_pwhash_scryptsalsa208sha256_saltbytes() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > 1U); assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > strlen(crypto_pwhash_scryptsalsa208sha256_strprefix())); assert(crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() > 0U); printf("OK\n"); return 0; }
int run_main (int, ACE_TCHAR *[]) { int ret = 0; ACE_START_TEST (ACE_TEXT ("Time_Value_Test")); ACE_Time_Value tv1; ACE_Time_Value tv2 (2); ACE_Time_Value tv3 (100U); ACE_Time_Value tv4 (1, 1000000); ACE_Time_Value tv5 (2UL); ACE_Time_Value tv6 (1, -1000000); ACE_Time_Value tv7 (ACE_static_cast (long, 2.0)); // Beware! 2.5 gets truncated to 2! // NOTE: this is intended to show what happens with // ACE_Time_Value (2.5). Some compilers, such as g++ 2.7.2.3, // actually warn about it without the case. ACE_Time_Value tv8 (ACE_static_cast (long, 2.5)); // Test assignment operator, tv9 and tv6 must be the same after this ACE_Time_Value tv9; tv9 = tv6; ACE_ASSERT (tv1 == ACE_Time_Value (0)); ACE_ASSERT (tv2 < tv3); ACE_ASSERT (tv2 <= tv2); ACE_ASSERT (tv2 >= tv4); ACE_ASSERT (tv5 >= tv6); ACE_ASSERT (tv2 == ACE_Time_Value (1, 1000000)); ACE_ASSERT (tv5 == tv4); ACE_ASSERT (tv2 == tv4); ACE_ASSERT (tv1 != tv2); ACE_ASSERT (tv6 == tv1); ACE_ASSERT (tv5 == tv7); ACE_ASSERT (tv7 == tv8); // That's right! See above . . . ACE_ASSERT (tv9 == tv6); #if defined (sun) && !defined (ACE_LACKS_LONGLONG_T) if (test_ace_u_longlong () != 0) ++ret; #endif /* sun && ! ACE_LACKS_LONGLONG_T */ ACE_END_TEST; return ret; }
int DealerSvcHandler::handle_output(ACE_HANDLE){ ACE_Message_Block *mb; ACE_Time_Value tv(TIMEOUT_VALUE1); int queue_length = this->getq(mb, &tv); if (queue_length > -1) { ACE_Time_Value tv2(TIMEOUT_VALUE2); int retval = peer().send(mb->rd_ptr(), mb->length(), &tv2); if (retval == -1) { std::cout << "Error sending data." << std::endl; return 1; } mb->release(); } if (queue_length == 0) { ACE_Reactor::instance ()->mask_ops(this, ACE_Event_Handler::READ_MASK, ACE_Reactor::SET_MASK); } return 0; }
int U_EXPORT main (int argc, char* argv[]) { U_ULIB_INIT(argv); U_TRACE(5,"main(%d)",argc) UTimeVal x; x.set(0L); U_ASSERT(x.isZero()); UTimeVal a(1L); UTimeVal y(a); a.add(8L, 1999999L); a.sub(8L, 1999999L); U_ASSERT(y == a); U_ASSERT(y == UTimeVal(1L)); U_ASSERT(y <= UTimeVal(1L)); U_ASSERT(y >= UTimeVal(1L)); U_ASSERT(y > UTimeVal(0L, 999999)); U_ASSERT(y < UTimeVal(1L, 2L)); y = a; U_ASSERT(y == a); UTimeVal tv1; UTimeVal tv2(2); UTimeVal tv3(100); UTimeVal tv4(1, 100000); UTimeVal tv5(2); UTimeVal tv6(1, -100000); tv1.set(0L); U_ASSERT(tv1 == x); U_ASSERT(tv2 < tv3); U_ASSERT(tv2 <= tv2); U_ASSERT(tv2 >= tv4); U_ASSERT(tv5 >= tv6); U_ASSERT(tv5 != tv4); U_ASSERT(tv2 != tv4); U_ASSERT(tv1 != tv2); U_ASSERT(tv6 != tv1); U_gettimeofday U_ASSERT(y < *u_now); set_alarm(); y.nanosleep(); y += *u_now; U_ASSERT(y > *u_now); /* long start = (u_now->tv_sec - (u_now->tv_sec % U_ONE_HOUR_IN_SECOND)); for (uint32_t i = 0; i <= U_ONE_DAY_IN_SECOND; ++i) check_time(start+i); */ }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int idle_count = 0; try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Panic: nil RootPOA\n"), 1); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; Hello *hello_impl = 0; ACE_NEW_RETURN (hello_impl, Hello (orb.in ()), 1); PortableServer::ServantBase_var owner_transfer(hello_impl); PortableServer::ObjectId_var id = root_poa->activate_object (hello_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); Test::Hello_var hello = Test::Hello::_narrow (object.in ()); CORBA::String_var ior = orb->object_to_string (hello.in ()); // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s\n", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); poa_manager->activate (); for (;;) { ACE_Time_Value tv (0, 500); while (orb->work_pending (tv)) { ACE_DEBUG ((LM_DEBUG, "Work pending\n")); ACE_Time_Value tv2 (0, 500); if (orb->work_pending (tv2)) { ACE_Time_Value work_tv (0, 500); orb->perform_work (work_tv); } } ++idle_count; } orb->destroy (); } catch (const CORBA::BAD_INV_ORDER&) { // Expected } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } if (idle_count == 0) { ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Got unexpected idle_count %d\n", idle_count), 1); } else { ACE_DEBUG ((LM_DEBUG, "Got %d idle moments\n", idle_count)); } return 0; }
int main(void) { tv(); tv2(); tv3(); str_tests(); assert(crypto_pwhash_bytes_min() > 0U); assert(crypto_pwhash_bytes_max() > crypto_pwhash_bytes_min()); assert(crypto_pwhash_passwd_max() > crypto_pwhash_passwd_min()); assert(crypto_pwhash_saltbytes() > 0U); assert(crypto_pwhash_strbytes() > 1U); assert(crypto_pwhash_strbytes() > strlen(crypto_pwhash_strprefix())); assert(crypto_pwhash_opslimit_min() > 0U); assert(crypto_pwhash_opslimit_max() > 0U); assert(crypto_pwhash_memlimit_min() > 0U); assert(crypto_pwhash_memlimit_max() > 0U); assert(crypto_pwhash_opslimit_interactive() > 0U); assert(crypto_pwhash_memlimit_interactive() > 0U); assert(crypto_pwhash_opslimit_moderate() > 0U); assert(crypto_pwhash_memlimit_moderate() > 0U); assert(crypto_pwhash_opslimit_sensitive() > 0U); assert(crypto_pwhash_memlimit_sensitive() > 0U); assert(strcmp(crypto_pwhash_primitive(), "argon2i") == 0); assert(crypto_pwhash_bytes_min() == crypto_pwhash_BYTES_MIN); assert(crypto_pwhash_bytes_max() == crypto_pwhash_BYTES_MAX); assert(crypto_pwhash_passwd_min() == crypto_pwhash_PASSWD_MIN); assert(crypto_pwhash_passwd_max() == crypto_pwhash_PASSWD_MAX); assert(crypto_pwhash_saltbytes() == crypto_pwhash_SALTBYTES); assert(crypto_pwhash_strbytes() == crypto_pwhash_STRBYTES); assert(crypto_pwhash_opslimit_min() == crypto_pwhash_OPSLIMIT_MIN); assert(crypto_pwhash_opslimit_max() == crypto_pwhash_OPSLIMIT_MAX); assert(crypto_pwhash_memlimit_min() == crypto_pwhash_MEMLIMIT_MIN); assert(crypto_pwhash_memlimit_max() == crypto_pwhash_MEMLIMIT_MAX); assert(crypto_pwhash_opslimit_interactive() == crypto_pwhash_OPSLIMIT_INTERACTIVE); assert(crypto_pwhash_memlimit_interactive() == crypto_pwhash_MEMLIMIT_INTERACTIVE); assert(crypto_pwhash_opslimit_moderate() == crypto_pwhash_OPSLIMIT_MODERATE); assert(crypto_pwhash_memlimit_moderate() == crypto_pwhash_MEMLIMIT_MODERATE); assert(crypto_pwhash_opslimit_sensitive() == crypto_pwhash_OPSLIMIT_SENSITIVE); assert(crypto_pwhash_memlimit_sensitive() == crypto_pwhash_MEMLIMIT_SENSITIVE); assert(crypto_pwhash_argon2id_bytes_min() == crypto_pwhash_bytes_min()); assert(crypto_pwhash_argon2id_bytes_max() == crypto_pwhash_bytes_max()); assert(crypto_pwhash_argon2id_passwd_min() == crypto_pwhash_passwd_min()); assert(crypto_pwhash_argon2id_passwd_max() == crypto_pwhash_passwd_max()); assert(crypto_pwhash_argon2id_saltbytes() == crypto_pwhash_saltbytes()); assert(crypto_pwhash_argon2id_strbytes() == crypto_pwhash_strbytes()); assert(strcmp(crypto_pwhash_argon2id_strprefix(), crypto_pwhash_strprefix()) == 0); assert(crypto_pwhash_argon2id_opslimit_min() == crypto_pwhash_opslimit_min()); assert(crypto_pwhash_argon2id_opslimit_max() == crypto_pwhash_opslimit_max()); assert(crypto_pwhash_argon2id_memlimit_min() == crypto_pwhash_memlimit_min()); assert(crypto_pwhash_argon2id_memlimit_max() == crypto_pwhash_memlimit_max()); assert(crypto_pwhash_argon2id_opslimit_interactive() == crypto_pwhash_opslimit_interactive()); assert(crypto_pwhash_argon2id_opslimit_moderate() == crypto_pwhash_opslimit_moderate()); assert(crypto_pwhash_argon2id_opslimit_sensitive() == crypto_pwhash_opslimit_sensitive()); assert(crypto_pwhash_argon2id_memlimit_interactive() == crypto_pwhash_memlimit_interactive()); assert(crypto_pwhash_argon2id_memlimit_moderate() == crypto_pwhash_memlimit_moderate()); assert(crypto_pwhash_argon2id_memlimit_sensitive() == crypto_pwhash_memlimit_sensitive()); assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_argon2id_alg_argon2id13()); assert(crypto_pwhash_alg_argon2i13() == crypto_pwhash_ALG_ARGON2I13); assert(crypto_pwhash_alg_argon2i13() != crypto_pwhash_alg_default()); assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_ALG_ARGON2ID13); assert(crypto_pwhash_alg_argon2id13() != crypto_pwhash_alg_argon2i13()); assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_alg_default()); assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page, crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE, crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE, 0) == -1); assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page, crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE, crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE, crypto_pwhash_ALG_ARGON2I13) == -1); assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page, crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE, crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE, 0) == -1); assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page, crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE, crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE, crypto_pwhash_ALG_ARGON2ID13) == -1); printf("OK\n"); return 0; }