int main(int argc, char** argv){ Eigen::Vector3d N( -0.000000000, -0.104038047, 0.000000000); Eigen::Vector3d H1(-0.901584415, 0.481847022, -1.561590016); Eigen::Vector3d H2(-0.901584415, 0.481847022, 1.561590016); Eigen::Vector3d H3( 1.803168833, 0.481847022, 0.000000000); std::vector<Sphere> spheres; Sphere sph1(N, 2.929075493); Sphere sph2(H1, 2.267671349); Sphere sph3(H2, 2.267671349); Sphere sph4(H3, 2.267671349); spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); double probeRadius = 1.385; // Probe Radius for water int patchLevel = 2; double coarsity = 0.5; WaveletCavity cavity(spheres, probeRadius, patchLevel, coarsity); cavity.readCavity("molec_dyadic.dat"); double permittivity = 78.39; Vacuum * gfInside = new Vacuum(2); // Automatic directional derivative UniformDielectric * gfOutside = new UniformDielectric(2, permittivity); int firstKind = 0; PWCSolver solver(gfInside, gfOutside, firstKind); solver.buildSystemMatrix(cavity); cavity.uploadPoints(solver.getQuadratureLevel(), solver.getT_(), false); }
int check_h() { int i,flg=0; for(i=0; i<E; i++) { h(i)=H3(en(i,0)-1,0)-H3(en(i,1)-1,0); qc(i)=c(i)*(h(i)+Hd(i)); if(ch(i)==1) { Re=ro*qc(i)*D(i)/(A(i)*mu); f(i)=.094*pow(K(i),0.225)+0.53*K(i)+88*pow(K(i),0.44)*pow(fabs(Re),(-1.62*pow(K(i),0.134))); hc(i)=f(i)*L(i)*pow(qc(i),2)/(2*g*D(i)*pow(A(i),2))+k(i)*pow(qc(i),2)/(2*g*pow(A(i),2)); } else if (ch(i)==2 && qc(i)>0) { hc(i)=pow((qc(i)/A(i)),2)/(2*g)-Hd(i); } else if(ch(i)==2 && qc(i)<0) { hc(i)=-pow((qc(i)/A(i)),2)/(2*g)-Hd(i); } else if(ch(i)==3) { hc(i)=k(i)*pow((qc(i)/A(i)),2)/(2*g)*pow((100.0/o(i)),(2*n(i))); } cc(i)=fabs(qc(i)/(hc(i)+Hd(i))); err(i)=fabs(fabs(hc(i))-fabs(h(i)))/fabs(h(i))*100; qDebug()<<"hc "<<hc(i)<<"h "<<h(i)<<"D "<<D(i)<<"f "<<f(i)<<"L "<<L(i)<<"A "<<A(i); if(err(i)<rangep) { flg++; } if(hc(i)!=hc(i)) { qDebug()<<"Inside break for NaN"; stop=1; } } qDebug()<<"flg "<< flg; return flg; }
Molecule C2H4() { int nAtoms = 6; Eigen::Vector3d C1(0.0000000000, 0.0000000000, 1.2578920000); Eigen::Vector3d H1(0.0000000000, 1.7454620000, 2.3427160000); Eigen::Vector3d H2(0.0000000000, -1.7454620000, 2.3427160000); Eigen::Vector3d C2(0.0000000000, 0.0000000000, -1.2578920000); Eigen::Vector3d H3(0.0000000000, 1.7454620000, -2.3427160000); Eigen::Vector3d H4(0.0000000000, -1.7454620000, -2.3427160000); Eigen::MatrixXd geom(3, nAtoms); geom.col(0) = C1.transpose(); geom.col(1) = H1.transpose(); geom.col(2) = H2.transpose(); geom.col(3) = C2.transpose(); geom.col(4) = H3.transpose(); geom.col(5) = H4.transpose(); Eigen::VectorXd charges(6), masses(6); charges << 6.0, 1.0, 1.0, 6.0, 1.0, 1.0; masses << 12.00, 1.0078250, 1.0078250, 12.0, 1.0078250, 1.0078250; double radiusC = (1.70 * 1.20) / convertBohrToAngstrom; double radiusH = (1.20 * 1.20) / convertBohrToAngstrom; std::vector<Atom> atoms; atoms.push_back( Atom("Carbon", "C", charges(0), masses(0), radiusC, C1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(1), masses(1), radiusH, H1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(2), masses(2), radiusH, H2, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(3), masses(3), radiusC, C2, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(4), masses(4), radiusH, H3, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(5), masses(5), radiusH, H4, 1.0) ); std::vector<Sphere> spheres; Sphere sph1(C1, radiusC); Sphere sph2(H1, radiusH); Sphere sph3(H2, radiusH); Sphere sph4(C2, radiusC); Sphere sph5(H3, radiusH); Sphere sph6(H4, radiusH); spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); spheres.push_back(sph5); spheres.push_back(sph6); // D2h as generated by Oxy, Oxz, Oyz Symmetry pGroup = buildGroup(3, 4, 2, 1); return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup); };
Molecule H3() { int nAtoms = 3; Eigen::Vector3d H1( 0.735000, 0.000000, -1.333333); Eigen::Vector3d H2(-0.735000, 0.000000, -1.333333); Eigen::Vector3d H3( 0.000000, 0.000000, 2.666667); Eigen::MatrixXd geom(3, nAtoms); geom.col(0) = H1.transpose(); geom.col(1) = H2.transpose(); geom.col(2) = H3.transpose(); Eigen::Vector3d charges, masses; charges << 1.0, 1.0, 1.0; masses << 1.0078250, 1.0078250, 1.0078250; std::vector<Atom> atoms; double radiusH = (1.20 * 1.20) / convertBohrToAngstrom; atoms.push_back( Atom("Hydrogen", "H", charges(0), masses(0), radiusH, H1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(1), masses(1), radiusH, H2, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(2), masses(2), radiusH, H3, 1.0) ); std::vector<Sphere> spheres; Sphere sph2(H1, radiusH); Sphere sph3(H2, radiusH); Sphere sph4(H3, radiusH); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); enum pointGroup { pgC1, pgC2, pgCs, pgCi, pgD2, pgC2v, pgC2h, pgD2h }; Symmetry pGroup; switch(group) { case(pgC1): pGroup = buildGroup(0, 0, 0, 0); break; case(pgC2v): // C2v as generated by Oyz and Oxz pGroup = buildGroup(2, 1, 2, 0); break; default: pGroup = buildGroup(0, 0, 0, 0); break; } return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup); };
Molecule NH3() { int nAtoms = 4; Eigen::Vector3d N( -0.000000000, -0.104038047, 0.000000000); Eigen::Vector3d H1(-0.901584415, 0.481847022, -1.561590016); Eigen::Vector3d H2(-0.901584415, 0.481847022, 1.561590016); Eigen::Vector3d H3( 1.803168833, 0.481847022, 0.000000000); Eigen::MatrixXd geom(3, nAtoms); geom.col(0) = N.transpose(); geom.col(1) = H1.transpose(); geom.col(2) = H2.transpose(); geom.col(3) = H3.transpose(); Eigen::Vector4d charges, masses; charges << 7.0, 1.0, 1.0, 1.0; masses << 14.0030740, 1.0078250, 1.0078250, 1.0078250; std::vector<Atom> atoms; atoms.push_back( Atom("Nitrogen", "N", charges(0), masses(0), 2.929075493, N, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(1), masses(1), 2.267671349, H1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(2), masses(2), 2.267671349, H2, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(3), masses(3), 2.267671349, H3, 1.0) ); std::vector<Sphere> spheres; Sphere sph1(N, 2.929075493); Sphere sph2(H1, 2.267671349); Sphere sph3(H2, 2.267671349); Sphere sph4(H3, 2.267671349); spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); // C1 Symmetry pGroup = buildGroup(0, 0, 0, 0); return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup); };
Molecule CH3() { int nAtoms = 4; Eigen::Vector3d C1( 0.0006122714, 0.0000000000, 0.0000000000); Eigen::Vector3d H1( 1.5162556382, -1.3708721537, 0.0000000000); Eigen::Vector3d H2(-0.7584339548, 0.6854360769, 1.7695110698); Eigen::Vector3d H3(-0.7584339548, 0.6854360769, -1.7695110698); Eigen::MatrixXd geom(3, nAtoms); geom.col(0) = C1.transpose(); geom.col(1) = H1.transpose(); geom.col(2) = H2.transpose(); geom.col(3) = H3.transpose(); Eigen::Vector4d charges, masses; charges << 6.0, 1.0, 1.0, 1.0; masses << 12.00, 1.0078250, 1.0078250, 1.0078250; double radiusC = (1.70 * 1.20) / convertBohrToAngstrom; double radiusH = (1.20 * 1.20) / convertBohrToAngstrom; std::vector<Atom> atoms; atoms.push_back( Atom("Carbon", "C", charges(0), masses(0), radiusC, C1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(1), masses(1), radiusH, H1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(2), masses(2), radiusH, H2, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(3), masses(3), radiusH, H3, 1.0) ); std::vector<Sphere> spheres; Sphere sph1(C1, radiusC); Sphere sph2(H1, radiusH); Sphere sph3(H2, radiusH); Sphere sph4(H3, radiusH); spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); // Cs as generated by Oxy Symmetry pGroup = buildGroup(1, 4, 0, 0); return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup); };
static int get_hash_3(int index) { H3(crypt_out[index]); }
static int binary_hash_3(void *binary) { H3((char *)binary); }
wxString GenerateHTMLString() { gCurrentString = _T(""); AddStringLn(_T("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>")); AddStringLn(_T("<html>")); AddStringLn(_T("<head>")); // Although the file is going to be written as UTF-8, we set the charset here to // Western-1252, which is the only format supported by CHM files. The generated HTML files // then need to be converted to ANSI using a text editor. AddStringLn(_T("<meta http-equiv='content-type' content='text/html; charset=Western-1252'>")); AddStringLn(_T("<title>Appetizer</title>")); AddStringLn(_T("<style TYPE='text/css'>")); AddStringLn(_T("<!--")); AddStringLn(_T("h2 { color:#ff4f02; }")); AddStringLn(_T("h3 { }")); AddStringLn(_T("-->")); AddStringLn(_T("</style>")); AddStringLn(_T("</head>")); AddStringLn(_T("<body>")); IMG(_T("images/Logo.jpg")); // ******************************************************************************* // INTRODUCTION // ******************************************************************************* H2(_("Introduction")); H3(_("About Appetizer")); P(_("Appetizer is a free application launcher, or dock, for Windows. It allows organizing and launching your applications and other shortcuts into a convenient dock. The app is skinable and entirely customizable.")); P(_("Additionally, the application supports the [http://portableapps.com PortableApps] format. So if you use Appetizer on a removable drive in the PortableApps format, the application will detect it and automatically import all your applications along with the 'Documents', 'Videos', 'Music' and 'Pictures' folders.")); // ------------------------------------------------- // Features // ------------------------------------------------- H3(_("Features")); StartList(); LI(_("Support for multiple skins")); LI(_("Support for plugins")); LI(_("Resizable dock, which allows displaying the icons both horizontally or vertically.")); LI(_("Three sizes of icons: Small, large and extra-large")); LI(_("Support for custom icons")); LI(_("'Wizard' to automatically imports shortcuts from various locations")); LI(_("Organize the icons by drag & dropping them")); LI(_("'Multi-launch' functionality")); LI(_("Regroup multiple shortcuts within one menu")); LI(_("Hot key to hide / show the dock")); LI(_("Special items to provide extra functionalities: hide / show the desktop, Recycle Bin, Control Panel, etc.")); LI(_("Support for multiple languages")); LI(_("Minimize to tray icon functionality")); EndList(); IMG(_T("images/Screenshot.jpg")); // ******************************************************************************* // USING APPETIZER // ******************************************************************************* AddAnchor(_T("Usage")); H2(_("Using Appetizer")); P(_("Appetizer is made to be simple and intuitive. To get more information about an icon or a button, simply move the mouse over it. Additionally, try right-clicking the dock in different places - certain parts of the application such as the icons or the icon panel provide various contextual actions.")); // ------------------------------------------------- // Adding a shortcut // ------------------------------------------------- H3(_("Adding a shortcut")); P(_("To add a shortcut, right-click anywhere on the icon panel and select 'New shortcut', then select a file or folder. Alternatively, you may also directly drag and drop a file onto the dock.")); // ------------------------------------------------- // Adding a group // ------------------------------------------------- H3(_("Adding a group of shortcuts")); P(_("To create a group of shortcuts, right-click anywhere on the icon panel, select 'New group', give a name to the group, and click 'Save'. To add shortcuts to this group, click or right-click on it and select 'Organize group shortcuts'. The newly opened window display all your shortcuts in a tree-like control. You can drag & drop these icons to add them to the group. You can also reorder them, still by drag & dropping them. Once this is done, click the 'Close' button.")); // ------------------------------------------------- // Adding a special item // ------------------------------------------------- H3(_("Adding a special items")); P(_("Special items provide additional functionalities that would not be possible using a normal shortcut. The special items include a 'Show desktop' button, the Recycle Bin, a link to the Control Panel, etc.")); P(_("To add a special item, right-click on the dock and select 'Add special item'.")); // ------------------------------------------------- // Modifying or deleting a group or shortcut // ------------------------------------------------- H3(_("Modifying, moving or deleting a group or shortcut")); P(_("To change the properties of an icon, such as its name or location, right-click on it and select 'Properties'. To move an icon to a different location, click and drag it. To remove a shortcut, right-click on it and select 'Remove'.")); // ------------------------------------------------- // Changing the properties of a shortcut or group // ------------------------------------------------- AddAnchor(_T("FolderItemProperties")); H3(_("Changing the properties of a shortcut or group")); P(_("To change the properties of a shortcut or group, right-click on an icon and select 'Properties'. The following options are available:")); StartList(); LI(_("Name: The name displayed in the tooltip")); LI(_("Location: The target of the shortcut. Click on the '...' button to change it.")); LI(_("Parameters: You may also specify some additional command line arguments in this field. This could be a path to a file or some switches specific to the application. This field is only relevant for executables and is optional.")); LI(_("Icon: Click on 'Change icon' to select a custom icon. Click on 'Use default' to revert the icon to the default.")); EndList(); // ------------------------------------------------- // Minimizing / Maximizing the dock // ------------------------------------------------- H3(_("Minimizing / Maximizing the dock")); P(_("The dock can be minimized to the tray icon by clicking on the 'x' button. To bring it back to front, simply click on the tray icon. Note that this behavior can be changed in the 'Configuration' dialog")); P(_("Right-click on the tray icon for additional options.")); // ------------------------------------------------- // The option panel // ------------------------------------------------- AddAnchor(_T("OptionPanel")); H3(_("The option panel")); IMG(_T("images/OptionPanel.jpg")); P(_("The option panel pops up when you click on the big arrow button. If you move the mouse over any of its buttons, a tooltip will show up giving you more information.")); // ------------------------------------------------- // Importing several shortcuts automatically // ------------------------------------------------- AddAnchor(_T("Import")); H3(_("Importing several shortcuts automatically")); P(_("It is possible to automatically import shortcuts into Appetizer from various locations, including the Windows 'Start menu', the 'Quick Launch' toolbar, or the PortableApps folder. To do so, click on [images/ImportButton.jpg] in the [#OptionPanel option panel] and select where you would like to import shortcuts from, then click 'Start'.")); // ------------------------------------------------- // Launching several application simultaneously // ------------------------------------------------- AddAnchor(_T("Multilaunch")); H3(_("Launching several application simultaneously")); P(_("Appetizer provides a functionality to launch several applications at the click of a button. This is equivalent to the Startup menu on Windows, except that it launches the app on your portable drive. To use this 'Multi-launch' group, follow these steps:")); StartList(); LI(_("Right-click on any icon and select 'Multi-launch group' from the context menu")); LI(_("You can add as many shortcuts as you wish")); LI(_("To trigger the 'Multi-launch' group, open the [#OptionPanel option panel] and click on the 'Multi-launch' button: [images/Multilaunch.jpg]")); EndList(); // ******************************************************************************* // PLUGINS // ******************************************************************************* AddAnchor(_T("Plugins")); H2(_("Plugins")); P(_("Appetizer supports a plugin system that allows easily adding new functionalities and customizing the application to your needs.")); // ------------------------------------------------- // Adding new plugins // ------------------------------------------------- AddAnchor(_T("AddingPlugins")); H3(_("Adding a plugin")); P(_("To add a plugin, follow these steps:")); StartList(); LI(_("Open the [#Configuring Configuration dialog].")); LI(_("Open the 'Plugin' tab.")); LI(_("Click the 'Install...' button and open the plugin's .zpl package.")); LI(_("If everything went well, you should see a message saying that the plugin was successfully installed. However, note that it will only be active the next time Appetizer is started.")); EndList(); // ------------------------------------------------- // Creating a plugin // ------------------------------------------------- AddAnchor(_T("CreatingPlugin")); H3(_("Creating a plugin")); P(_("Information on how to create a plugin is available on [http://app.etizer.org/wiki/creating-a-plugin Appetizer's website]")); // ******************************************************************************* // CONFIGURING APPETIZER // ******************************************************************************* AddAnchor(_T("Configuring")); H2(_("Configuring Appetizer")); P(_("The configuration dialogue is accessible by clicking on the 'Configuration' button in the [#OptionPanel option panel]. The description of each setting is given below:")); AddAnchor(_T("ConfiguringGeneral")); // ------------------------- // General // ------------------------- H3(_("General")); StartList(); LI(_("[b]Language:[/b] Select your language here. If you wish to contribute and translate Appetizer in your own language, please [#Translating follow this link].")); LI(_("[b]Always on top:[/b] If this is selected the bar will always remain on top of the other windows.")); LI(_("[b]Allow only one instance of Appetizer at a time:[/b] If this is selected, only one instance of Appetizer can run at a time.")); LI(_("[b]Install autorun file:[/b] Clicking this button will install an autorun file on your removable drive. This will allow Appetizer to automatically start when you insert the drive. However, note that in some instances Windows may prevent the autorun from being executed, for example for security reason or because the computer is set that way.")); LI(_("[b]Check for update:[/b] Click this button to check if a new update is available.")); EndList(); // ------------------------- // Appearance // ------------------------- AddAnchor(_T("ConfiguringAppearance")); H3(_("Appearance")); StartList(); LI(_("[b]Icon size:[/b] Choose the size of the icons.")); LI(_("[b]Orientation:[/b] The bar can be vertically or horizontally orientated.")); LI(_("[b]Skin:[/b] Choose one of the available skins.")); EndList(); // ------------------------- // Operations // ------------------------- AddAnchor(_T("ConfiguringOperations")); H3(_("Operations")); StartList(); LI(_("[b]Auto-hide after launching an application:[/b] Select this option to have Appetizer hides itself each time you launch an application.")); LI(_("[b]When ejecting the drive, close the apps that are locking it:[/b] If this option is selected, all the apps that are open on your removable drive will be closed when you click on the 'Eject' button.")); LI(_("[b]Run multi-launch group on startup:[/b] Tick off this option to automatically run the [#Multilaunch multi-launch group] on startup.")); LI(_("[b]'Close' button minimizes to System Tray:[/b] By default, the application is minimized to the System Tray when the 'Close' button is clicked. Tick off this option to make the 'Close' button actually close the app.")); LI(_("[b]Hot key to hide / show the bar:[/b] Select the hot key to hide / show the bar. Select 'none' to disable it.")); EndList(); // ------------------------- // Import // ------------------------- AddAnchor(_T("ConfiguringImport")); H3(_("Import")); StartList(); LI(_("[b]Exclude these items from the import operations:[/b] Normally, when importing shortcuts using the [#Import import tool], all the executables are added to the dock. If you wish to exclude certain files, add them to this list. The item names may be specified with [http://www.computerhope.com/jargon/w/wildcard.htm wildcards]. Note that this list is also automatically populated whenever you remove a shortcut from the dock.")); EndList(); // ------------------------- // Plugins // ------------------------- AddAnchor(_T("ConfiguringPlugins")); H3(_("Plugins")); P(_("This tab displays the plugins that are currently installed along with their status.")); StartList(); LI(_("[b]Enable / Disable buttons:[/b] Click these buttons to enable / disable the selected plugin.")); LI(_("[b]Install...:[/b] Click to [#AddingPlugins install a new plugin].")); EndList(); // ******************************************************************************* // OTHER TIPS // ******************************************************************************* H2(_("Other tips")); StartList(); LI(_("You can resize the dock by clicking and dragging its bottom right corner.")); LI(_("You can move it by clicking anywhere on the icon panel and dragging.")); LI(_("The bar will snap to the borders of the screens as you move it.")); EndList(); // ******************************************************************************* // TRANSLATING APPETIZER // ******************************************************************************* AddAnchor(_T("Translating")); H2(_("Translating Appetizer")); P(wxString::Format(_("If Appetizer is not available in your own language, you can easily create your own translation. Please [%s follow this link] for more information."), _T("http://app.etizer.org/translations/"))); // ******************************************************************************* // MORE LINKS // ******************************************************************************* AddAnchor(_T("Links")); H2(_("Support and links")); P(wxString::Format(_("Official home page: %s"), _T("[http://app.etizer.org http://app.etizer.org]"))); P(wxString::Format(_("Project home page: %s"), _T("[https://sourceforge.net/projects/appetizer https://sourceforge.net/projects/appetizer]"))); P(wxString::Format(_("Some information on how to create a plugin: %s"), _T("[http://app.etizer.org/wiki/creating-a-plugin http://app.etizer.org/wiki/creating-a-plugin]"))); P(wxString::Format(_("Beta versions and preleases are usually on [%s PortableApps Beta Testing forum]"), _T("http://portableapps.com/forums/development/beta_testing"))); P(wxString::Format(_("For bug reports, suggestions, comments or translations, please contact %s"), imayle));//wxString::Format(_T("<a href=\"mailto:%s\">%s</a> or post on the beta forum."), imayle, imayle))); AddStringLn(_T("</body>")); AddStringLn(_T("</html>")); return gCurrentString; }
/////////////////////////////////////////////////////////////////////////// // Drawing Firework /////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// void DrawFirework(int no) { /* to display * each firework particle * You should calculate and display the trail of each * particle here */ int i, j, k, u; float interpolated_pt[2]; float Color[4]; for (i=0; i< fire[no].total_no; i++) { // if the paticle is still "alive" if (!fire[no].particle[i].death) { glLineWidth(1.5); glBegin(GL_LINE_STRIP); // for each paticle, generate its spline curve Color[0] = fire[no].particle[i].col[0]; Color[1] = fire[no].particle[i].col[1]; Color[2] = fire[no].particle[i].col[2]; Color[3] = fire[no].particle[i].col[3]; for (k=0; k<3; k++) Color[k] = 1.0; // print the initial position glColor4fv(Color); glVertex2fv(fire[no].init_pos); // interpolation for (u=1; u<=10; u++) { for (j=0; j<2; j++) // using the Hermite Spline Interpolation technique to find the interpolated points interpolated_pt[j] = fire[no].init_pos[j]*H0(u/10.0)+ fire[no].particle[i].pos[j]*H1(u/10.0)+ fire[no].particle[i].init_vel[j]*fire[no].t*H2(u/10.0)+ fire[no].particle[i].vel[j]*fire[no].t*H3(u/10.0); // print the interpolated points for (k=0; k<3; k++) Color[k] = (1-fire[no].particle[i].col[k])*0.49 + fire[no].particle[i].col[k]; glColor4fv(Color); glVertex2fv(interpolated_pt); } // print the current point for (k=0; k<3; k++) Color[k] = (1-fire[no].particle[i].col[k])*0.4 + fire[no].particle[i].col[k]; glColor4fv(Color); glVertex2fv(fire[no].particle[i].pos); glEnd(); } } }
wxString GenerateHTMLString() { gCurrentString = _T(""); AddStringLn(_T("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>")); AddStringLn(_T("<html>")); AddStringLn(_T("<head>")); AddStringLn(_T("<meta http-equiv='content-type' content='text/html; charset=Western-1252'>")); AddStringLn(_T("<title>Appetizer</title>")); AddStringLn(_T("<style TYPE='text/css'>")); AddStringLn(_T("<!--")); AddStringLn(_T("h2 { color:#ff4f02; }")); AddStringLn(_T("h3 { }")); AddStringLn(_T("-->")); AddStringLn(_T("</style>")); AddStringLn(_T("</head>")); AddStringLn(_T("<body>")); IMG(_T("images/Logo.jpg")); // ******************************************************************************* // INTRODUCTION // ******************************************************************************* H2(_("Introduction")); H3(_("About Appetizer")); P(_("Appetizer is a dock bar that allows you to organize, display and launch your applications and other shortcuts. Currently it is possible to add executables, documents and folders to the dock. Additionally, if you use Appetizer on a USB key in the [http://portableapps.com PortableApps] format, the application will detect it and automatically import all your applications along with the 'Documents', 'Videos', 'Music' and 'Pictures' folders.")); // ------------------------------------------------- // Features // ------------------------------------------------- H3(_("Features")); StartList(); LI(_("Resizable dock, which allows displaying the icons both horizontally or vertically.")); LI(_("Support for multiple skins")); LI(_("Two size of icons: Small and large")); LI(_("Organize the icons by drag & dropping them")); LI(_("'Multi-launch' functionality")); LI(_("Regroup multiple shortcuts within one menu")); LI(_("Support for multiple languages")); LI(_("Minimize to tray icon functionality")); EndList(); IMG(_T("images/Screenshot.jpg")); // ******************************************************************************* // USING APPETIZER // ******************************************************************************* H2(_("Using Appetizer")); P(_("Appetizer is made to be simple and intuitive. To get more information about an icon or a button, simply move the mouse over it. Additionally, try right-clicking the dock in different places - certain parts of the application such as the icons or the icon panel provide various contextual actions.")); // ------------------------------------------------- // Adding a shortcut // ------------------------------------------------- H3(_("Adding a shortcut")); P(_("To add a shortcut, right-click anywhere on the icon panel and select 'New shortcut', then click on [images/SelectFile.jpg] to select a file or [images/SelectFolder.jpg] to select a folder. Once this is done, the 'Name' field should be automatically populated based on the file or folder you've chosen. Finally, you may also specify some additional parameters in the 'Parameters' field. This could be a path to a file or some switches specific to the application. This field is only relevant for executables and is optional.")); // ------------------------------------------------- // Adding a group // ------------------------------------------------- H3(_("Adding a group of shortcuts")); P(_("To create a group of shortcuts, right-click anywhere on the icon panel, select 'New group', give a name to the group, and click 'Save'. To add shortcuts to this group, click or right-click on it and select 'Organize group shortcuts'. The newly opened window display all your shortcuts in a tree-like control. You can drag & drop these icons to add them to the group. You can also reorder them in a different, still by drag & dropping them. Once this is done, click the 'Close' button.")); // ------------------------------------------------- // Changing the icon of a group // ------------------------------------------------- H3(_("Changing the icon of a group")); P(_("A group can take the icon of any of the shortcuts it contains. To do so, right-click on a group and select 'Properties'. Then click on 'Select a different icon'. If the group doesn't contain any shortcut, only the default icon can be selected.")); // ------------------------------------------------- // Modifying or deleting a group or shortcut // ------------------------------------------------- H3(_("Modifying, moving or deleting a group or shortcut")); P(_("To change the properties of an icon, such as its name or location, right-click on it and select 'Properties'. To move an icon to a different location, click and drag it. To remove a shortcut, right-click on it and select 'Remove'.")); // ------------------------------------------------- // Minimizing / Maximizing the dock // ------------------------------------------------- H3(_("Minimizing / Maximizing the dock")); P(_("The dock can be minimized to the tray icon by clicking on the 'x' button. To bring it back to front, simply click on the tray icon.")); P(_("Right-click on the tray icon for additional options.")); // ------------------------------------------------- // The option panel // ------------------------------------------------- A(_T(""), _T(""), _T("OptionPanel")); H3(_("The option panel")); IMG(_T("images/OptionPanel.jpg")); P(_("The option panel pops up when you click on the big arrow button. If you move the mouse over any of its buttons, a tooltip will show up giving you more information.")); // ------------------------------------------------- // Launching several application simultaneously // ------------------------------------------------- H3(_("Launching several application simultaneously")); P(_("Appetizer provides a functionality to launch several applications at the click of a button. This is equivalent to the Startup menu on Windows, except that it launches the app on your portable drive. To use this 'Multi-launch' group, follow these steps:")); StartList(); LI(_("Right-click on any icon and select 'Multi-launch group' from the context menu")); LI(_("You can add as many shortcuts as you wish")); LI(_("To trigger the 'Multi-launch' group, open the [#OptionPanel option panel] and click on the 'Multi-launch' button: [images/Multilaunch.jpg]")); EndList(); // ******************************************************************************* // CONFIGURING APPETIZER // ******************************************************************************* H2(_("Configuring Appetizer")); P(_("The configuration dialogue is accessible by clicking on the 'Configuration' button in the [#OptionPanel option panel]. The description of each setting is given below:")); H3(_("General")); StartList(); LI(_("[b]Language:[/b] Select your language here. If you wish to contribute and translate Appetizer in your own language, please [#Translating follow this link].")); LI(_("[b]Auto-hide after launching an application:[/b] Select this option to have Appetizer hides itself each time you launch an application.")); LI(_("[b]Always on top:[/b] If this is selected the bar will always remain on top of the other windows.")); LI(_("[b]Allow only one instance of Appetizer at a time:[/b] If this is selected, only one instance of Appetizer can run at a time.")); LI(_("[b]Check for update:[/b] Click this button to check if a new update is available.")); EndList(); H3(_("Appearance")); StartList(); LI(_("[b]Icon size:[/b] Choose the size of the icons, as displayed on the bar.")); LI(_("[b]Orientation:[/b] The bar can be vertically or horizontally orientated.")); LI(_("[b]Skin:[/b] Choose one of the available skins.")); EndList(); // ******************************************************************************* // OTHER TIPS // ******************************************************************************* H2(_("Other tips")); StartList(); LI(_("You can resize the dock by clicking and dragging its bottom right corner.")); LI(_("You can move it by clicking anywhere on the icon panel and dragging.")); LI(_("The bar will snap to the borders of the screens as you move it.")); EndList(); // ******************************************************************************* // TRANSLATING APPETIZER // ******************************************************************************* A(_T(""), _T(""), _T("Translating")); H2(_("Translating Appetizer")); P(_("If Appetizer is not available in your own language, you can easily create your own translation. To do so, please follow these steps:")); StartList(); LI(_("[http://www.poedit.net/ Download Poedit] and install it. This is a utility that makes it easier to create and maintain translation files.")); LI(_("Open the folder where you've installed Appetizer and open the Data\\Locale folder")); LI(_("Copy and paste the 'en' folder.")); LI(_("Within that folder, open 'appetizer.po' with Poedit.")); LI(_("In Poedit, go into the Catalog menu and click Configuration. Change 'Country' and 'Language' to your own country and language.")); LI(_("Now, to translate a line of text, click on it and add your translated text in the bottom text field.")); LI(_("Once all the text is translated, please email 'appetizer.po' and 'appetizer.mo' to [email protected]")); EndList(); P(_("Your translation will be added in the next release.")); H3(_("Translating the help file")); P(_("If you wish to translate the help file, follow the same steps as above and edit the file in Data\\Help\\en\\appetizer.po.")); AddStringLn(_T("</body>")); AddStringLn(_T("</html>")); return gCurrentString; }
Molecule C6H6() { int nAtoms = 12; // These are in Angstrom Eigen::Vector3d C1(5.274, 1.999, -8.568); Eigen::Vector3d C2(6.627, 2.018, -8.209); Eigen::Vector3d C3(7.366, 0.829, -8.202); Eigen::Vector3d C4(6.752, -0.379, -8.554); Eigen::Vector3d C5(5.399, -0.398, -8.912); Eigen::Vector3d C6(4.660, 0.791, -8.919); Eigen::Vector3d H1(4.704, 2.916, -8.573); Eigen::Vector3d H2(7.101, 2.950, -7.938); Eigen::Vector3d H3(8.410, 0.844, -7.926); Eigen::Vector3d H4(7.322, -1.296, -8.548); Eigen::Vector3d H5(4.925, -1.330, -9.183); Eigen::Vector3d H6(3.616, 0.776, -9.196); // Scale C1 /= convertBohrToAngstrom; C2 /= convertBohrToAngstrom; C3 /= convertBohrToAngstrom; C4 /= convertBohrToAngstrom; C5 /= convertBohrToAngstrom; C6 /= convertBohrToAngstrom; H1 /= convertBohrToAngstrom; H2 /= convertBohrToAngstrom; H3 /= convertBohrToAngstrom; H4 /= convertBohrToAngstrom; H5 /= convertBohrToAngstrom; H6 /= convertBohrToAngstrom; Eigen::MatrixXd geom(3, nAtoms); geom.col(0) = C1.transpose(); geom.col(1) = C2.transpose(); geom.col(2) = C3.transpose(); geom.col(3) = C4.transpose(); geom.col(4) = C5.transpose(); geom.col(5) = C6.transpose(); geom.col(6) = H1.transpose(); geom.col(7) = H2.transpose(); geom.col(8) = H3.transpose(); geom.col(9) = H4.transpose(); geom.col(10) = H5.transpose(); geom.col(11) = H6.transpose(); Eigen::VectorXd charges(12), masses(12); charges << 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0; masses << 12.00, 12.0, 12.0, 12.0, 12.0, 12.0, 1.0078250, 1.0078250, 1.0078250, 1.0078250, 1.0078250, 1.0078250; double radiusC = 1.70 / convertBohrToAngstrom; double radiusH = 1.20 / convertBohrToAngstrom; std::vector<Atom> atoms; atoms.push_back( Atom("Carbon", "C", charges(0), masses(0), radiusC, C1, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(1), masses(1), radiusC, C2, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(2), masses(2), radiusC, C3, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(3), masses(3), radiusC, C4, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(4), masses(4), radiusC, C5, 1.0) ); atoms.push_back( Atom("Carbon", "C", charges(5), masses(5), radiusC, C6, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(6), masses(6), radiusH, H1, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(7), masses(7), radiusH, H2, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(8), masses(8), radiusH, H3, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(9), masses(9), radiusH, H4, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(10), masses(10), radiusH, H5, 1.0) ); atoms.push_back( Atom("Hydrogen", "H", charges(11), masses(11), radiusH, H6, 1.0) ); std::vector<Sphere> spheres; Sphere sph1(C1, radiusC); Sphere sph2(C2, radiusC); Sphere sph3(C3, radiusC); Sphere sph4(C4, radiusC); Sphere sph5(C5, radiusC); Sphere sph6(C6, radiusC); Sphere sph7(H1, radiusH); Sphere sph8(H2, radiusH); Sphere sph9(H3, radiusH); Sphere sph10(H4, radiusH); Sphere sph11(H5, radiusH); Sphere sph12(H6, radiusH); spheres.push_back(sph1); spheres.push_back(sph2); spheres.push_back(sph3); spheres.push_back(sph4); spheres.push_back(sph5); spheres.push_back(sph6); spheres.push_back(sph7); spheres.push_back(sph8); spheres.push_back(sph9); spheres.push_back(sph10); spheres.push_back(sph11); spheres.push_back(sph12); // D2h as generated by Oxy, Oxz, Oyz Symmetry pGroup = buildGroup(0, 0, 0, 0); return Molecule(nAtoms, charges, masses, geom, atoms, spheres, pGroup); };
void tSecureStream::m_setupClient(const tRSA& rsa, string appGreeting) { // This block is protected by constant timing in case // there is a man-in-the-middle who is causing the client // connection to fail over-and-over and analysing the time // it takes for the client to re-start the connection. // This block prevents info from being leaked about the // particular pre_secret that is being used by the current // connection attempt. vector<u8> rand_c, pre_secret, enc; { tConstTimeBlock ctb(&gClientInitTimingHistory); // Generate the client random vector. rand_c = s_genRand(kRandVectLen); // Generate the pre-secret random vector. pre_secret = s_genRand(kPreSecretLen); // Encrypt the pre-secret under the server's RSA public key. enc = rsa.encrypt(pre_secret); } // Send all this to the server. pack(m_internal_writable, kLibrhoGreeting); pack(m_internal_writable, appGreeting); pack(m_internal_writable, rand_c); pack(m_internal_writable, enc); s_flush(m_internal_writable); // Read the greeting from the server. // We don't care if timing info is leaked here // because 'kSuccessfulGreeting' is not a secret. string greetingResponse; try { unpack(m_internal_readable, greetingResponse, (u32)(std::max(kSuccessfulGreeting.length(), kFailedGreeting.length()))); } catch (ebObject& e) { throw eRuntimeError("The secure server didn't reply with its greeting."); } if (greetingResponse != kSuccessfulGreeting) throw eRuntimeError("The secure server sent a failure greeting."); // Read the random server bytes. // Again, we don't care about leaking timing info here. vector<u8> rand_s; try { unpack(m_internal_readable, rand_s, kRandVectLen); } catch (ebObject& e) { throw eRuntimeError("The secure server sent a random vector of the wrong length."); } if (rand_s.size() != kRandVectLen) throw eRuntimeError("The secure server sent a random vector of the wrong length."); // Another const timing block. vector<u8> secret, fPrime, g; { tConstTimeBlock ctb(&gClientProcessResponseTimingHistory); // Calculated the shared secret (from the pre-secret). secret = H1(pre_secret, rand_c, rand_s); // Calculate the correct response from the server. fPrime = H2(secret, rand_c, rand_s); // Calculate the proof-of-client. g = H3(secret, rand_c, rand_s); } // Read the proof-of-server hash. vector<u8> f; try { unpack(m_internal_readable, f, (u32)fPrime.size()); } catch (ebObject& e) { throw eRuntimeError("The secure server failed to verify itself."); } if (!s_constTimeIsEqual(f, fPrime)) throw eRuntimeError("The secure server failed to verify itself."); // Send the proof-of-client. (That is, prove we are not just replaying some other connection.) pack(m_internal_writable, g); s_flush(m_internal_writable); // Setup secure streams with the server. vector<u8> ksw = H4(pre_secret, secret, rand_c, rand_s); // <-- the Key for the Server Writer vector<u8> kcw = H5(pre_secret, secret, rand_c, rand_s); // <-- the Key for the Client Writer m_readable = new tReadableAES(m_internal_readable, kOpModeCBC, &ksw[0], s_toKeyLen(ksw.size())); m_writable = new tWritableAES(m_internal_writable, kOpModeCBC, &kcw[0], s_toKeyLen(kcw.size())); }
// Fonction d'intérpolation Hermite void SolveTCB ( float t, int *x, int *y, int *z) { // Déclaration des Keyframes utilisés Key *NextKey, *NextNextKey, *CurKey, *PrevKey; // Varaible d'incrémentation int i; // Taille du tableau de Keyframe const int NumKeys = ((double)sizeof(TabKey))/((double)sizeof(Key)); const int NumKeysMinusOne = NumKeys-1; // Boucle de parcours des Keyframes //.. for(i = 0; i < NumKeys;i++) { NextKey = &TabKey[i]; if (t<NextKey->t){ if(i==0) { CurKey = &TabKey[NumKeysMinusOne]; PrevKey = &TabKey[NumKeysMinusOne-1]; NextNextKey = &TabKey[1]; } else if(i==1){ CurKey = &TabKey[0]; PrevKey = &TabKey[NumKeysMinusOne]; NextNextKey = &TabKey[2]; } else if(i==NumKeysMinusOne){ CurKey = &TabKey[i-1]; PrevKey = &TabKey[i-2]; NextNextKey = &TabKey[0]; } else { CurKey = &TabKey[i-1]; PrevKey = &TabKey[i-2]; NextNextKey = &TabKey[i+1]; } // calcul tangents //curent float u = ((t-CurKey->t) / (NextKey->t - CurKey->t)); float ctx,cty,ctz; float ntx,nty,ntz; ctx = Tn(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.x,CurKey->pos.x); cty = Tn(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.y,CurKey->pos.y); ctz = Tn(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.z,CurKey->pos.z); //printf("ctx -- > %lf \n",ctx); //next ntx = Tn1(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.x,CurKey->pos.x,NextKey->pos.x,NextNextKey->pos.x); nty = Tn1(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.y,CurKey->pos.y,NextKey->pos.y,NextNextKey->pos.y); ntz = Tn1(CurKey->tension,CurKey->bias,CurKey->continuity,PrevKey->pos.z,CurKey->pos.z,NextKey->pos.z,NextNextKey->pos.z); //printf(" ntx -- > %lf \n",ntx); // mise a jour des positions *x = (int) (H0(u)*CurKey->pos.x + H1(u)*NextKey->pos.x + H2(u)*ctx + H3(u)*ntx); *y = (int) (H0(u)*CurKey->pos.y + H1(u)*NextKey->pos.y + H2(u)*cty + H3(u)*nty); *z = (int) (H0(u)*CurKey->pos.z + H1(u)*NextKey->pos.z + H2(u)*ctz + H3(u)*ntz); printf("\n%lf\n",( CurKey->pos.x )); printf("\n%lf, %lf\n",H1(t),( NextKey->pos.x )); printf("\n%lf\n",( H2(t)*CurKey->tension )); printf("\n%lf\n",( H3(t)*NextKey->tension )); //printf(" time -> %f X -- > %d \n",t,*x); //printf(" H0(t) = %f , H1(t) = %f , H2(t) = %f , H3(t) = %f \n",H0(t),H1(t),H2(t),H3(t)); //if(*x < (-8000) || *x > 8000) //exit(0); //break; return; } } time = 0; return; }
static int get_hash_3(int index) { H3(buffer[index].out); }
int main(void) { setbuf(stdout, NULL); init_EVP(); openmp_thread_setup(); printf("Iterations of SHA: %d\n", NUM_ROUNDS); clock_t begin = clock(), delta, deltaFiles; a as[NUM_ROUNDS]; z zs[NUM_ROUNDS]; FILE *file; char outputFile[3*sizeof(int) + 8]; sprintf(outputFile, "out%i.bin", NUM_ROUNDS); file = fopen(outputFile, "rb"); if (!file) { printf("Unable to open file!"); } fread(&as, sizeof(a), NUM_ROUNDS, file); fread(&zs, sizeof(z), NUM_ROUNDS, file); fclose(file); uint32_t y[8]; reconstruct(as[0].yp[0],as[0].yp[1],as[0].yp[2],y); printf("Proof for hash: "); for(int i=0;i<8;i++) { printf("%02X", y[i]); } printf("\n"); deltaFiles = clock() - begin; int inMilliFiles = deltaFiles * 1000 / CLOCKS_PER_SEC; printf("Loading files: %ju\n", (uintmax_t)inMilliFiles); clock_t beginE = clock(), deltaE; int es[NUM_ROUNDS]; H3(y, as, NUM_ROUNDS, es); deltaE = clock() - beginE; int inMilliE = deltaE * 1000 / CLOCKS_PER_SEC; printf("Generating E: %ju\n", (uintmax_t)inMilliE); clock_t beginV = clock(), deltaV; #pragma omp parallel for for(int i = 0; i<NUM_ROUNDS; i++) { int verifyResult = verify(as[i], es[i], zs[i]); if (verifyResult != 0) { printf("Not Verified %d\n", i); } } deltaV = clock() - beginV; int inMilliV = deltaV * 1000 / CLOCKS_PER_SEC; printf("Verifying: %ju\n", (uintmax_t)inMilliV); delta = clock() - begin; int inMilli = delta * 1000 / CLOCKS_PER_SEC; printf("Total time: %ju\n", (uintmax_t)inMilli); openmp_thread_cleanup(); cleanup_EVP(); return EXIT_SUCCESS; }
void tSecureStream::m_setupServer(const tRSA& rsa, string appGreeting) { // Read the greeting (part 1) from the client. // Note: The following DOES leak timing information, but we don't // care because 'kLibrhoGreeting' isn't a secret. string receivedLibrhoGreeting; try { unpack(m_internal_readable, receivedLibrhoGreeting, (u32)kLibrhoGreeting.size()); } catch (ebObject& e) { s_failConnection(m_internal_writable, "The secure client did not greet me properly."); } if (receivedLibrhoGreeting != kLibrhoGreeting) s_failConnection(m_internal_writable, "The secure client did not greet me properly."); // Read the greeting (part 2) from the client. // Note: The following DOES leak timing information, but we don't // care because 'appGreeting' isn't a secret. string receivedAppGreeting; try { unpack(m_internal_readable, receivedAppGreeting, (u32)appGreeting.size()); } catch (ebObject& e) { s_failConnection(m_internal_writable, "The secure client requested a different application."); } if (receivedAppGreeting != appGreeting) s_failConnection(m_internal_writable, "The secure client requested a different application."); // Read the client's random bytes. // Again, we don't care about the leaked info here because the correct // random vector length is not a secret. vector<u8> rand_c; try { unpack(m_internal_readable, rand_c, kRandVectLen); } catch (ebObject& e) { s_failConnection(m_internal_writable, "The secure client sent a random byte vector of the wrong length."); } if (rand_c.size() != kRandVectLen) s_failConnection(m_internal_writable, "The secure client sent a random byte vector of the wrong length."); // Read the encrypted pre-secret from the client. // (No info is leaked by this section.) vector<u8> enc; try { unpack(m_internal_readable, enc, rsa.maxMessageLength()+5); } catch (ebObject& e) { s_failConnection(m_internal_writable, "The secure client failed to send an encrypted pre-secret."); } // Now that the server has read everything from the client, it // will do some calculations. // We will protect this section with a const time block to // protect against timing side-channel attacks. vector<u8> pre_secret, rand_s, secret, f, gPrime; { // This object is constructed in this code block, and it // will be destructed when this block ends. The d'tor of // this class calls sleep() in order to enforce consistent // timing of the execution of this block. tConstTimeBlock ctb(&gServerProcessGreetingTimingHistory); // Decrypt the pre-secret and make sure it looks okay. pre_secret = rsa.decrypt(enc); if (pre_secret.size() != kPreSecretLen) s_failConnection(m_internal_writable, "The secure client gave a pre-secret that is the wrong length."); // Generate the server random byte vector. rand_s = s_genRand(kRandVectLen); // Calculated the shared secret (from the pre-secret). secret = H1(pre_secret, rand_c, rand_s); // Calculate the proof-of-server hash. (The convinces the client that we are the actual server.) f = H2(secret, rand_c, rand_s); // Calculate what the client correct response would be. gPrime = H3(secret, rand_c, rand_s); } // Write back to the client all this stuff. pack(m_internal_writable, kSuccessfulGreeting); pack(m_internal_writable, rand_s); pack(m_internal_writable, f); s_flush(m_internal_writable); // Have the client prove that it is a real client, not a reply attack. vector<u8> g; try { unpack(m_internal_readable, g, (u32)gPrime.size()); } catch (ebObject& e) { throw eRuntimeError("The secure client failed to show proof that it is real."); } if (!s_constTimeIsEqual(g, gPrime)) throw eRuntimeError("The secure client failed to show proof that it is real."); // Setup secure streams with the client. vector<u8> ksw = H4(pre_secret, secret, rand_c, rand_s); // <-- the Key for the Server Writer vector<u8> kcw = H5(pre_secret, secret, rand_c, rand_s); // <-- the Key for the Client Writer m_readable = new tReadableAES(m_internal_readable, kOpModeCBC, &kcw[0], s_toKeyLen(kcw.size())); m_writable = new tWritableAES(m_internal_writable, kOpModeCBC, &ksw[0], s_toKeyLen(ksw.size())); }