Пример #1
0
int main()
{
    setLog();
    testThreadPool();
    testSHA1();
    testUtf8();
    testFile();
    testUrl();
    return 0;
}
Пример #2
0
int
main(int argc, char **argv)
{
    NSSLOWInitContext *initCtx;
    int rv = 0; /* counts the number of failures */

    progName = strrchr(argv[0], '/');
    progName = progName ? progName + 1 : argv[0];

    initCtx = NSSLOW_Init();
    if (initCtx == NULL) {
        SECU_PrintError(progName, "Couldn't initialize for hashing\n");
        return 1;
    }

    if (argc || !argv[1] || strlen(argv[1]) == 0) {
        rv += testMD5(initCtx);
        rv += testSHA1(initCtx);
        rv += testSHA224(initCtx);
        rv += testSHA256(initCtx);
        rv += testSHA384(initCtx);
        rv += testSHA512(initCtx);
    } else if (strcmp(argv[1], "MD5") == 0) {
        rv += testMD5(initCtx);
    } else if (strcmp(argv[1], "SHA1") == 0) {
        rv += testSHA1(initCtx);
    } else if (strcmp(argv[1], "SHA224") == 0) {
        rv += testSHA224(initCtx);
    } else if (strcmp(argv[1], "SHA226") == 0) {
        rv += testSHA256(initCtx);
    } else if (strcmp(argv[1], "SHA384") == 0) {
        rv += testSHA384(initCtx);
    } else if (strcmp(argv[1], "SHA512") == 0) {
        rv += testSHA512(initCtx);
    } else {
        SECU_PrintError(progName, "Unsupported hash type %s\n", argv[0]);
        Usage(progName);
    }

    NSSLOW_Shutdown(initCtx);

    return (rv == 0) ? 0 : 1;
}