コード例 #1
0
ファイル: testcryp.c プロジェクト: cookrn/openamq
int main (int argc, char *argv [])
{
    FILE
        *file;
    clock_t
        clk_idea = 0,
        clk_mdc  = 0,
        clk_des  = 0,
        clk_xor  = 0;
    long
        file_length = 0;

    signal (SIGINT,  handle_signal);
    signal (SIGSEGV, handle_signal);
    signal (SIGTERM, handle_signal);

    if (argc == 1)
        printf ("Error : no file for test\n");

    file = fopen (argv[1], "rb");
    if (file)
      {
        fseek (file, 0, SEEK_END);
        file_length = ftell (file);
        printf("Test IDEA in progress...\n");
        clk_idea = test_crypt (file, CRYPT_IDEA);
        printf("Test MDC  in progress...\n");
        clk_mdc  = test_crypt (file, CRYPT_MDC );
        printf("Test XOR  in progress...\n");
        clk_xor  = test_crypt (file, CRYPT_XOR );
        printf("Test DES  in progress...\n");
        clk_des  = test_crypt (file, CRYPT_DES );

        fclose (file);
        printf ("Test of Encryption/decryption functions\n");
        printf ("---------------------------------------\n");
        printf (" IDEA : %4.01f sec / %ld bytes\n",
                (float)clk_idea / CLOCKS_PER_SEC,
                file_length
               );
        printf (" MDC  : %4.01f sec / %ld bytes\n",
                (float)clk_mdc  / CLOCKS_PER_SEC,
                file_length
               );
        printf (" XOR  : %4.01f sec / %ld bytes\n",
                (float)clk_xor  / CLOCKS_PER_SEC,
                file_length
               );
        printf (" DES  : %4.01f sec / %ld bytes\n",
                (float)clk_des  / CLOCKS_PER_SEC,
                file_length
               );
      }
    return (EXIT_SUCCESS);
}
コード例 #2
0
ファイル: testpass.c プロジェクト: dtrebbien/apr
static void * APR_THREAD_FUNC testing_thread(apr_thread_t *thd,
                                             void *data)
{
    abts_case *tc = data;
    int i;

    for (i = 0; i < 100; i++) {
        test_crypt(tc, NULL);
    }

    return APR_SUCCESS;
}
コード例 #3
0
ファイル: tst_crypt.c プロジェクト: CretescuMihai/lab
int main()
{
  RSA *rsa, *rsa_pub;
  DES_cblock des_key;
  rsa = crypt_new( des_key, "tst-des.key", "tst-pub.pem", "tst-priv.pem");
  rsa_pub = crypt_read( des_key, "tst-des.key", "tst-pub.pem");

  test_crypt( rsa, rsa_pub, des_key, "0123456789", 10);
  remove("tst-des.key");
  remove("tst-pub.pem");
  remove("tst-priv.pem");
}