Sample code

Long dataGMT = System.now().getTime() / 1000;
system.debug('dataGMT = ' + dataGMT);
String token = 'Q1' + dataGMT + 'Q2';
system.debug('token = ' + token);
System.debug(LoggingLevel.INFO, 'MD5Hash(token) === ' + MD5Hash(token));
public static String MD5Hash(String value) {
    return hash('MD5', value);

public static String hash(String algorithmName, String input) {
    return EncodingUtil.convertToHex(Crypto.generateDigest(algorithmName, Blob.valueOf(input)));

How to get 32-bit uppercase?

The result of the sample code is 32-bit lowercase.

result : d06f11aa4627092e03400fc27ab09908 ---(32-bit lowercase)

Expected result : D06F11AA4627092E03400FC27AB09908 ---(32-bit uppercase)


What if you use MD5Hash(token).toUpperCase().

toUpperCase is a method in String which converts your string value to upper case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.