public static function hash($msg, $key = '', $length = Constants::GENERICHASH_BYTES)
    {
        # Test the length for validity.
        Helpers::rangeCheck($length, Constants::GENERICHASH_BYTES_MAX, Constants::GENERICHASH_BYTES_MIN, 'Hash', 'hash');

        # Test the message and key for string validity.
        Helpers::isString($msg, 'Hash', 'hash');
        Helpers::isString($key, 'Hash', 'hash');

        # Return the hash to the client.
        return \Sodium\crypto_generichash($msg, $key, $length);
    }