1
0

SwifterTestsRC4.swift 580 B

12345678910111213141516171819202122
  1. //
  2. // SwifterTestsRC4.swift
  3. // Swifter
  4. //
  5. // Copyright © 2016 Damian Kołakowski. All rights reserved.
  6. //
  7. import XCTest
  8. class SwifterTestsRC4: XCTestCase {
  9. func testRC4() {
  10. let encrypted = RC4.encrypt([UInt8]("Plaintext".utf8), [UInt8]("Key".utf8))
  11. XCTAssertEqual(encrypted, [0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3])
  12. let decrypted = RC4.decrypt([0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3], [UInt8]("Key".utf8))
  13. XCTAssertEqual(decrypted, [UInt8]("Plaintext".utf8))
  14. }
  15. }