Collapse
Submit a Service Request
Contact Information for Technical Support
My Service Notifications
Crypto API error - Invalid Request: Length of Text exceeds the 1 MB allowable limit
Answer ID 12719 |
Last Review Date 10/13/2023
How do we hash_256 the content of a string with more than 1 million bytes?
Environment:
Connect for PHP (CPHP), Custom Process Model (CPM), Custom Scripts
Issue:
In the Crypto API there is a hash_256 function that use this Crypto\MessageDigest object to hash text. It works fine except when more than 1 million bytes are passed:
Catch Error :
Invalid Request: Length of Text exceeds the 1 MB allowable limit
Invalid Request: Length of Text exceeds the 1 MB allowable limit
Resolution:
There is a way to do this using "Streaming" mode in Crypto API that is documented here. Scroll to the bottom to see Streaming mode, and a callback class is not needed for a MessageDigest.
For further details see
Answer ID 11883: HMAC Connect PHP Crypto SHA-256 Implementation