1
0

SwifterTestsRC4.swift 597 B

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