/* * USHAReset * * Description: * This function will initialize the SHA Context in preparation * for computing a new SHA message digest. * * Parameters: * context: [in/out] * The context to reset. * whichSha: [in] * Selects which SHA reset to call * * Returns: * sha Error Code. * */ int USHAReset(USHAContext *context, enum SHAversion whichSha) { if (!context) return shaNull; context->whichSha = whichSha; switch (whichSha) { case SHA1: return SHA1Reset((SHA1Context*)&context->ctx); case SHA224: return SHA224Reset((SHA224Context*)&context->ctx); case SHA256: return SHA256Reset((SHA256Context*)&context->ctx); case SHA384: return SHA384Reset((SHA384Context*)&context->ctx); case SHA512: return SHA512Reset((SHA512Context*)&context->ctx); default: return shaBadParam; } }
/*! Resets the object. */ void QCryptographicHash::reset() { switch (d->method) { case Sha1: sha1InitState(&d->sha1Context); break; #ifdef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 default: Q_ASSERT_X(false, "QCryptographicHash", "Method not compiled in"); Q_UNREACHABLE(); break; #else case Md4: md4_init(&d->md4Context); break; case Md5: MD5Init(&d->md5Context); break; case Sha224: SHA224Reset(&d->sha224Context); break; case Sha256: SHA256Reset(&d->sha256Context); break; case Sha384: SHA384Reset(&d->sha384Context); break; case Sha512: SHA512Reset(&d->sha512Context); break; case RealSha3_224: case Keccak_224: sha3Init(&d->sha3Context, 224); break; case RealSha3_256: case Keccak_256: sha3Init(&d->sha3Context, 256); break; case RealSha3_384: case Keccak_384: sha3Init(&d->sha3Context, 384); break; case RealSha3_512: case Keccak_512: sha3Init(&d->sha3Context, 512); break; #endif } d->result.clear(); }
/* SHA384 Low Level Interface */ int sha384_low_init(SHA384Context *context) { return SHA384Reset(context); }