dw.crypto
Class MessageDigest
Object
dw.crypto.MessageDigest
This class provides the functionality of a message digest algorithm, such as MD5 or SHA. Message digests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value. This implementation offers only stateless digest() methods. A Bytes object or String is passed to a digest() method and the computed hash is returned.

Note: this class handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, and 12.

Constants
DIGEST_MD2  :  String = "MD2"
Constant representing the MD2 algorithm.
Deprecated:
This algorithm is obsolete and and has been deprecated. Please use SHA-256 or SHA-512.
DIGEST_MD5  :  String = "MD5"
Constant representing the MD5 algorithm.
Deprecated:
This algorithm is obsolete and and has been deprecated. Please use SHA-256 or SHA-512.
DIGEST_SHA  :  String = "SHA"
Constant representing the SHA algorithm.
Deprecated:
This algorithm is obsolete and and has been deprecated. Please use SHA-256 or SHA-512.
DIGEST_SHA_1  :  String = "SHA-1"
Constant representing the SHA 1 algorithm.
Deprecated:
This algorithm is obsolete and and has been deprecated. Please use SHA-256 or SHA-512.
DIGEST_SHA_256  :  String = "SHA-256"
Constant representing the SHA 256 algorithm
DIGEST_SHA_512  :  String = "SHA-512"
Constant representing the SHA 512 algorithm
Properties
Constructor Summary
MessageDigest(algorithm : String)
Construct a MessageDigest with the specified algorithm name.
Method Summary
digest(input : String) : String
Digests the passed string and returns a computed hash value as a string.
digest(algorithm : String, input : Bytes) : Bytes
Computes the hash value for the passed array of bytes.
digest() : Bytes
Completes the hash computation by performing final operations such as padding.
digestBytes(input : Bytes) : Bytes
Computes the hash value for the passed Bytes.
updateBytes(input : Bytes) : void
Updates the digest using the passed Bytes.
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Constructor Detail
MessageDigest
public MessageDigest(algorithm : String)
Construct a MessageDigest with the specified algorithm name. The supported algorithms are:
  • SHA-256
  • SHA-512
Parameters:
algorithm - The standard name of the digest algorithm, must not be null and must be a supported algorithm.

Method Detail
digest
digest(input : String) : String
Digests the passed string and returns a computed hash value as a string. The passed String is first encoded into a sequence of bytes using the platform's default encoding. The digest then performs any prerequisite padding, before computing the hash value. The hash is then converted into a string by converting all digits to hexadecimal.
Deprecated:
Deprecated because the conversion of the input to bytes using the default platform encoding and the hex-encoded return value are not generally appropriate.
Parameters:
input - The value to hash as String, must not be null.
Returns:
The resulting hash value as hex-encoded string.

digest
digest(algorithm : String, input : Bytes) : Bytes
Computes the hash value for the passed array of bytes. The algorithm argument is optional. If null, then the algorithm established at construction time is used. The binary representation of the message is typically derived from a string and the resulting hash is typically converted with base64 back into a string. Example: Encoding.toBase64( digest( "MD5", new Bytes( "my password", "UTF-8" ) ) );
Deprecated:
Deprecated because the digest algorithm should be the one set in the constructor.
Parameters:
algorithm - The standard name of the digest algorithm, or null if the algorithm passed at construction time is to be used. The algorithm must be a supported algorithm.
input - The value to hash, must not be null.
Returns:
The resulting hash value.

digest
digest() : Bytes
Completes the hash computation by performing final operations such as padding. The binary representation of the message is typically derived from a string and the resulting hash is typically converted with base64 back into a string. Example: Encoding.toBase64( digest() );
Returns:
The resulting hash value.

digestBytes
digestBytes(input : Bytes) : Bytes
Computes the hash value for the passed Bytes. The binary representation of the message is typically derived from a string and the resulting hash is typically converted with base64 back into a string. Example: Encoding.toBase64( digest( new Bytes( "my password", "UTF-8" ) ) );
Parameters:
input - The value to hash, must not be null.
Returns:
The resulting hash value.

updateBytes
updateBytes(input : Bytes) : void
Updates the digest using the passed Bytes.
Parameters:
input - The value to hash, must not be null.

β™₯
Notifications pending to read