protected static function getConfig(string $stored): SymmetricConfig
    {
        $length = Binary::safeStrlen($stored);
        // This doesn't even have a header.
        if ($length < 8) {
            throw new InvalidMessage(
                'Encrypted password hash is way too short.'
            );
        }
        if (\hash_equals(Binary::safeSubstr($stored, 0, 5), Halite::VERSION_PREFIX)) {
            /** @var string $decoded */
            $decoded = Base64UrlSafe::decode($stored);
            return SymmetricConfig::getConfig(
                $decoded,
                'encrypt'
            );
        }
        $v = Hex::decode(Binary::safeSubstr($stored, 0, 8));
        return SymmetricConfig::getConfig($v, 'encrypt');
    }
protected static function getConfig(string $stored): SymmetricConfig
    {
        $length = Binary::safeStrlen($stored);
        // This doesn't even have a header.
        if ($length < 8) {
            throw new InvalidMessage(
                'Encrypted password hash is way too short.'
            );
        }
        if (\hash_equals(Binary::safeSubstr($stored, 0, 5), Halite::VERSION_PREFIX)) {
            /** @var string $decoded */
            $decoded = Base64UrlSafe::decode($stored);
            return SymmetricConfig::getConfig(
                $decoded,
                'encrypt'
            );
        }
        $v = Hex::decode(Binary::safeSubstr($stored, 0, 8));
        return SymmetricConfig::getConfig($v, 'encrypt');
    }
protected static function getConfig ( string $ stored ) : SymmetricConfig { $ length = Binary :: safeStrlen ( $ stored ) ; // This doesn't even have a header. if ( $ length < 8 ) { throw new InvalidMessage ( 'Encrypted password hash is way too short.' ) ; } if ( \ hash_equals ( Binary :: safeSubstr ( $ stored , 0 , 5 ) , Halite :: VERSION_PREFIX ) ) { /** @var string $decoded */ $ decoded = Base64UrlSafe :: decode ( $ stored ) ; return SymmetricConfig :: getConfig ( $ decoded , 'encrypt' ) ; } $ v = Hex :: decode ( Binary :: safeSubstr ( $ stored , 0 , 8 ) ) ; return SymmetricConfig :: getConfig ( $ v , 'encrypt' ) ; }
Get the configuration for this version of halite

@param string $stored   A stored password hash
@return SymmetricConfig

@throws InvalidMessage
@throws \TypeError
Get the configuration for this version of halite