Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CCHMacMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Encryption and Hash MBS MacOSX Plugin 11.3 Yes No No Yes, macOS only No
Function: Keyed Message Authentication Code (HMAC) functions.
Example:
dim h as new CCHMacMBS(CCHMacMBS.kCCHmacAlgSHA1, "Hello")
h.Update "Hello World!"
dim m as MemoryBlock = h.Finalize
MsgBox EncodingToHexMBS(m)
Notes: This class uses the CommonCrypto interface which is available on Mac OS X 10.5 or newer and also on iOS. So you can use it to get the same results on both operation systems. Also as you simply use Apple provided encryption, you don't need to apply for an export license for this classes here.

Feedback, Comments & Corrections

  • property Algorithm as Integer
  • 8 methods
    • method Constructor(algorithm as Integer, key as memoryblock)
    • method Constructor(algorithm as Integer, key as Ptr, keyLength as UInt64)
    • method Constructor(algorithm as Integer, key as string)
    • method Final(macOut as Ptr)
    • method Finalize as Memoryblock
    • method Update(data as memoryblock)
    • method Update(data as Ptr, dataLength as UInt64)
    • method Update(data as string)
  • 2 shared methods
    • shared method Hmac(algorithm as Integer, key as Ptr, keyLength as Integer, data as Ptr, dataLength as Integer, MacOut as Ptr)
    • shared method Hmac(algorithm as Integer, key as String, data as String) as String
  • 8 constants

Algorithms Constants

Constant Value Description
kCCHmacAlgMD5 1
kCCHmacAlgSHA1 0
kCCHmacAlgSHA224 5
kCCHmacAlgSHA256 2
kCCHmacAlgSHA384 3
kCCHmacAlgSHA512 4

Digest Length Constants

Constant Value Description
kCCMD5DigestLength 16
kCCSHA1DigestLength 20

This class has no sub classes.

Some examples which use this class:

Blog Entries


The items on this page are in the following plugins: MBS MacOSX Plugin.


CCCryptorMBS   -   CCMD2MBS




Links
MBS FileMaker blog