With release of version 4.0 Business Central 2019 wave 2, the existing encryption and hashing functions are moved to a separate codeunit called 1266 Cryptography Management.
It has different functions for:
- Data Encryption and Decryption
- To generate hash for different hashing algorithms from a string or stream. It supports hashing algorithms like MD5, SHA1, SHA256, SHA384, SHA512
- To generate base64 encoded hash from string. Again, it supports MD5, SHA1, SHA256, SHA384, SHA512 hashing algorithms
- To generate a key base64 encoded hash from a string based on the provided hash algorithm and key.
Here is the sample code on how to MD5 hash for the string value. Generally, we need to pass MD5 hash of password / login credentials while consuming API of the external applications.