fork download
  1. program simple_hash
  2. implicit none
  3.  
  4. character(len=100) :: text
  5. integer :: i
  6. integer :: hash_value
  7.  
  8. text = "202301044TanakaHiyori"
  9. hash_value = 0
  10.  
  11. do i = 1, len_trim(text)
  12. hash_value = mod(hash_value * 31 + iachar(text(i:i)), 100000)
  13. end do
  14.  
  15. print *, "入力データ : ", trim(text)
  16. print *, "ハッシュ値 : ", hash_value
  17.  
  18. end program simple_hash
Success #stdin #stdout 0s 5320KB
stdin
学籍番号:202301044
氏名:田中日和
stdout
 入力データ : 202301044TanakaHiyori
 ハッシュ値 :        51188