function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nida Khan 5Nida Khan 5 

How to generate 16 byte from the 64byte from the below code?

Hello All,

Can anyone please suggest how to generate 16byte from 64byte string.I have provided the sample code.Please provide me solution for the same with certain modifications to this code or new code.

public static String createHash(String preHashValue) {
       Blob bPrehash = Blob.valueOf(preHashValue);
       String convertedPrehash = EncodingUtil.convertToHex(bPrehash);
       Blob bHexPrehash = Blob.valueOf(convertedPrehash);
       Blob bsig = Crypto.generateDigest('SHA1', bHexPrehash);
       String result = EncodingUtil.convertToHex(bsig);
       return result;