hash_str Function

public pure function hash_str(str) result(hash)

Calculate a hash of the string

Arguments

TypeIntentOptionalAttributesName
character(len=*), intent(in) :: str

Return Value integer


Contents

Source Code


Source Code

pure function hash_str(str) result(hash)

    character(len=*), intent(in) :: str

    integer :: hash

    integer :: i

    hash = 3586
    do i = 1, len(str)
        hash = (ishft(hash,5) + hash) + ichar(str(i:i))
    end do

end function hash_str