I am trying to calculate a SHA2 checksum on a string in ABAP. I have come across the functions CALCULATE_HASH_FOR_CHAR and CALCULATE_HMAC_FOR_CHAR. However, CALCULATE_HASH_FOR_CHAR only can calculate a SHA1 (entering SHA2 returns nothing).
By contrast, CALCULATE_HMAC_FOR_CHAR seems to rely on entries maintained in the SecureStorage, so this is not really helpful to me (and I’m not sure it will give me the results I need).
Also, after seeing how FM SSFH_F4_HASHALG returns possible values for hash algorithms, it seems that the possible values are dependent on the version of sapseculib that you have installed.
Any ideas how else I can calculate a SHA2 hash in ABAP?
OK, it seems that the answer is to use class CL_ABAP_MESSAGE_DIGEST (and then specify SHA256 as the algorithm). This information is in note 1410294 (Support SHA2-family for Message Digest and HMAC) and requires a certain kernel patch level etc.