Password Migration with custom encryption

Hello!

My Todo: I want to import old, already encrypted passwords into Pimcore. When the user logs in for the first time, they should be re-encrypted.

Basically the following post describes a good solution as I find it:
(http://blog.michaelperrin.fr/2017/01/17/migrating-users-to-a-secure-hashing-algorithm-in-symfony/)

A code example from this post shows my problem:

# app/config/security.yml
security:  
    encoders:
        AppBundle\Entity\User:
            algorithm: bcrypt
        legacy_encoder:
            algorithm:        md5
            encode_as_base64: false
            iterations:       1

The old passwords are encrypted with an algorithm that Pimcore does not have on board. In the example above this is “md5”, at this point I want to use my own encryption. Here now to my question …

How can I include my own encryption in Pimcore so that I can include it as shown above?

AND

Does anyone already have experience with this topic and would choose a fundamentally different approach?

Thanks for your help.