Calculate a hash of the string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
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