Encrypt Identifiers in Health

Dear Consultants
Encrypted personal health information identifiers are essential these days.
I would really appreciate if you could help me to encrypt and decrypt as shown in the repex from the tidyverse.
Thank you very much.
G

toencrypt <- tibble::tribble(
               ~patientnumber, ~encounternumber, ~encryptedpatientnumber, ~encriptedencounternumber, ~decryptedpatientnumber, ~decriptedencounternumber,
                     "H12345",         "ip5678",                      NA,                        NA,                      NA,                        NA,
                     "H12345",         "op6789",                      NA,                        NA,                      NA,                        NA
               )
toencrypt
#> # A tibble: 2 x 6
#>   patientnumber encounternumber encryptedpatientnumber encriptedencounternumber
#>   <chr>         <chr>           <lgl>                  <lgl>                   
#> 1 H12345        ip5678          NA                     NA                      
#> 2 H12345        op6789          NA                     NA                      
#> # i 2 more variables: decryptedpatientnumber <lgl>,
#> #   decriptedencounternumber <lgl>

Created on 2025-07-24 with reprex v2.1.1

you could try the encryptr package:

install.packages("encryptr")

Thank you so much. The package looks nice. G