Activity Forums Salesforce® Discussions What is the purpose of using generateDigest method of Crypto Class?

  • What is the purpose of using generateDigest method of Crypto Class?

    Posted by Suraj on April 27, 2017 at 1:37 PM

    What is the purpose of using generateDigest method of Crypto Class?

    Saurabh replied 9 years ago 2 Members · 1 Reply
  • 1 Reply
  • Saurabh

    Member
    May 29, 2017 at 11:11 AM

    Hi Suraj

    generateDigest(algorithmName, input)
    Computes a secure, one-way hash digest based on the supplied input string and algorithm name.
    Signature
    public static Blob generateDigest(String algorithmName, Blob input)
    Parameters
    algorithmName
    Type: String
    Valid values for algorithmName are:

    MD5
    SHA1
    SHA-256
    SHA-512
    input
    Type: Blob
    Return Value
    Type: Blob
    Example
    Blob targetBlob = Blob.valueOf(‘ExampleMD5String’);
    Blob hash = Crypto.generateDigest(‘MD5’, targetBlob);

    Hope it may help

Log In to reply.