Swift
Swift
Example: Crypt2.CrcBd method
Demonstrates how to call the CrcBd method.Chilkat Swift Downloads
func chilkatTest() {
let crypt = CkoCrypt2()!
let bd = CkoBinData()!
bd.appendString(str: "123456789", charset: "us-ascii")
var crc32: UInt32 = crypt.crcBd(crcAlg: "crc-32", bd: bd)
// The decimal value is 3421780262 (converted to hex is 0xCBF43926)
print("\(crc32)")
var crc8: UInt32 = crypt.crcBd(crcAlg: "crc8", bd: bd)
print("\(crc8)")
}