CL_ABAP_MESSAGE_DIGEST - Cryptographic Hash Value of a Message

CL_GUI_FRONTEND_SERVICES - Frontend Services   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Functionality

This class allows the generation of a message digest, also known as a hash value.

These are one-way hash functions. The distinguishing features of these functions are that they are notreversible and that no collisions can be calculated. This means that it must not be possible to recreatethe original text for a cryptotext (irreversible). It must also not be possible to calculate a text that produces the same cryptotext as the original text (collision-free).

Relationships

Different hash algorithms, such as SHA1 or SHA256, are installed depending on the ABAP kernel.

Example

DATA: lo_digest TYPE Ref To cl_abap_message_digest.

DATA: lf_digest_string TYPE string.

lo_digest = cl_abap_message_digest=>get_instance( 'sha1' ).

" update digest with input

lo_digest->update( if_data = '010203' ).

" finalise digest

lo_digest->digest( ).

" String

lf_digest_string   = lo_digest->to_string( ).

" Base64 representation

lf_digest_64string = lo_digest->to_base64( ).

Notes

The calculation of a hash value is necessary, for example, to make long texts in a database table indexable.The length of a hash value is always constant; for example, 20 bytes for SHA1. Generating a hash from a string/long text in a table means that it can be indexed and can therefore be found again more quickly.

Further information

http://csrc.nist.gov/groups/STM/cavp/documents/shs/SHAVS.pdf



TXBHW - Original Tax Base Amount in Local Currency   General Data in Customer Master  
This documentation is copyright by SAP AG.


Length: 1629 Date: 20120526 Time: 082206     triton ( 78 ms )