/** * Determines which hashing function should be used for the mask generation function * * The mask generation function is used by CRYPT_RSA_ENCRYPTION_OAEP and CRYPT_RSA_SIGNATURE_PSS and although it's * best if Hash and MGFHash are set to the same thing this is not a requirement. * * @access public * @param String $hash */ function setMGFHash($hash) { // CryptHash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. switch ($hash) { case 'md2': case 'md5': case 'sha1': case 'sha256': case 'sha384': case 'sha512': $this->mgfHash = new CryptHash($hash); break; default: $this->mgfHash = new CryptHash('sha1'); } $this->mgfHLen = $this->mgfHash->getLength(); }