array_hash64_hex Function

public pure function array_hash64_hex(hash_value) result(text)

Format a digest as 16 lowercase hexadecimal characters.

Built from ibits and a lookup table rather than a Z edit descriptor, so the result is identical on every compiler and no internal I/O is involved.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: hash_value

Digest to format, typically from digest or array_hash64.

Return Value character(len=16)


Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: i
integer(kind=default_int), private :: nibble

Source Code

   pure function array_hash64_hex(hash_value) result(text)
      !! Format a digest as 16 lowercase hexadecimal characters.
      !!
      !! Built from `ibits` and a lookup table rather than a `Z` edit
      !! descriptor, so the result is identical on every compiler and no
      !! internal I/O is involved.
      integer(int64), intent(in) :: hash_value
         !! Digest to format, typically from `digest` or `array_hash64`.
      character(len=16) :: text

      integer(default_int) :: i, nibble

      do i = 1_default_int, 16_default_int
         nibble = int(ibits(hash_value, 4_default_int*(16_default_int - i), &
                            4_default_int), default_int)
         text(i:i) = HEX_DIGITS(nibble + 1_default_int:nibble + 1_default_int)
      end do
   end function array_hash64_hex