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

  • 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