Skip to content

Instantly share code, notes, and snippets.

@krzyzanowskim
Last active February 7, 2018 02:16
Show Gist options
  • Save krzyzanowskim/947c9d424130b0b534ffef415f88fc69 to your computer and use it in GitHub Desktop.
Save krzyzanowskim/947c9d424130b0b534ffef415f88fc69 to your computer and use it in GitHub Desktop.
func testAESEncryptPerformance() {
let key: Array<UInt8> = [0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
let iv: Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
let message = Array<UInt8>(repeating: 7, count: 1024 * 1024 * 10)
let aes = try! AES(key: key, blockMode: .CBC(iv: iv), padding: .pkcs7)
measure {
_ = try! aes.encrypt(message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment