diff options
Diffstat (limited to 'captain/crypt.f90')
-rw-r--r-- | captain/crypt.f90 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/captain/crypt.f90 b/captain/crypt.f90 index c14d4bb..c19efdc 100644 --- a/captain/crypt.f90 +++ b/captain/crypt.f90 @@ -28,7 +28,7 @@ contains character(len=*), intent(in)::phrase character(len=:), pointer::hash - character(len=:,kind=c_char), pointer::c_phrase + character(kind=c_char), dimension(:), pointer::c_phrase type(c_ptr)::c_res_ptr, c_salt_ptr character(kind=c_char), dimension(:), pointer::c_res character(len=5, kind=c_char), target::prefix @@ -48,8 +48,11 @@ contains prefix = "$2b$"//c_null_char c_salt_ptr = crypt_gensalt_c(c_loc(prefix), int(16,kind=c_long), c_null_ptr, 0) - allocate(character(len=len_trim(phrase)+1) :: c_phrase) - c_phrase = trim(phrase)//c_null_char + allocate(c_phrase(len_trim(phrase)+1)) + do i = 1,len_trim(phrase) + c_phrase(i) = phrase(i:i) + end do + c_phrase(len_trim(phrase)+1) = c_null_char c_res_ptr = crypt_c(c_loc(c_phrase), c_salt_ptr) if(c_associated(c_res_ptr)) then |