hash Function

pure elemental function hash(s)

Determine the ASCII code for the current character of the string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s

Return Value integer(kind=ip)


Called by

proc~~hash~~CalledByGraph proc~hash problem_15::hash program~problem_15 problem_15 program~problem_15->proc~hash

Source Code

    pure elemental integer(ip) function hash(s)
        !! Determine the ASCII code for the current character of the string.
        character(len=*),intent(in) :: s
        integer :: i
        hash = 0
        do i = 1, len(s)
            hash = modulo(17_ip*( hash + iachar(s(i:i))), 256_ip)
        end do
    end function hash