PSPDFSignatureHashAlgorithm

enum PSPDFSignatureHashAlgorithm {}

A hash algorithm or hash function is a function that maps data of arbitrary size to data of a fixed size. In the context of PDF, this arbitrary data may represent a part of a document. The output of a hash function is always identical if the input data is the same. This fact can be used to check if a document has been altered intentionally or accidentally.

PSPDFKit supports several hash functions. This list is not a complete list of every hash algorithm that is available. Some hash algorithms are not supported yet by the PDF specification for their use in digital signatures.

  • MD5 is a widely used hash algorithm, but it’s no longer considered secure. Use only for compatibility purposes.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmMD5

    Swift

    case MD5 = 0
  • Secure Hash Algorithm. SHA-160 is safer than MD5, but there are known security vulnerabilities since 2005.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmSHA160

    Swift

    case SHA160 = 1
  • Recommended. Secure Hash Algorithm with an output length of 224 bits.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmSHA224

    Swift

    case SHA224 = 2
  • Recommended. Secure Hash Algorithm with an output length of 256 bits.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmSHA256

    Swift

    case SHA256 = 3
  • Recommended. Secure Hash Algorithm with an output length of 384 bits.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmSHA384

    Swift

    case SHA384 = 4
  • Recommended. Secure Hash Algorithm with an output length of 512 bits.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmSHA512

    Swift

    case SHA512 = 5
  • This is a hash algorithm we don’t know about yet.

    Declaration

    Objective-C

    PSPDFSignatureHashAlgorithmUnknown

    Swift

    case unknown = 6