TwofishTests.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. // TwofishTests.swift
  2. // This file is part of KeePassKit.
  3. //
  4. // Copyright © 2019 Maxime Epain. All rights reserved.
  5. //
  6. // KeePassKit is free software: you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // KeePassKit is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with KeePassKit. If not, see <https://www.gnu.org/licenses/>.
  18. import Binary
  19. import XCTest
  20. @testable import Crypto
  21. class TwofishTests: XCTestCase {
  22. override func setUp() {
  23. // Put setup code here. This method is called before the invocation of each test method in the class.
  24. }
  25. override func tearDown() {
  26. // Put teardown code here. This method is called after the invocation of each test method in the class.
  27. }
  28. // func testKey128_1() throws {
  29. // let key = Bytes(hex: "00000000000000000000000000000000")!
  30. // var pt = Bytes(hex: "00000000000000000000000000000000")!
  31. // let ct = try Twofish(key: key).encrypt(data: pt)
  32. // XCTAssertEqual(ct.hexa.uppercased(), "9F589F5CF6122C32B6BFEC2F2AE8C35A", "Twofish: Encrypt Keysize=128 I=1 failed")
  33. //
  34. // pt = try Twofish(key: key).decrypt(data: ct)
  35. // XCTAssertEqual(pt.hexa.uppercased(), "00000000000000000000000000000000", "Twofish: Decrypt Keysize=128 I=1 failed")
  36. // }
  37. //
  38. // func testKey128_2() throws {
  39. // let key = Bytes(hex: "00000000000000000000000000000000")!
  40. // var pt = Bytes(hex: "9F589F5CF6122C32B6BFEC2F2AE8C35A")!
  41. // let ct = try Twofish(key: key).encrypt(data: pt)
  42. // XCTAssertEqual(ct.hexa.uppercased(), "D491DB16E7B1C39E86CB086B789F5419", "Twofish: Encrypt Keysize=128 I=2 failed")
  43. //
  44. // pt = try Twofish(key: key).decrypt(data: ct)
  45. // XCTAssertEqual(pt.hexa.uppercased(), "9F589F5CF6122C32B6BFEC2F2AE8C35A", "Twofish: Decrypt Keysize=128 I=2 failed")
  46. // }
  47. //
  48. // func testKey128_3() throws {
  49. // let key = Bytes(hex: "9F589F5CF6122C32B6BFEC2F2AE8C35A")!
  50. // var pt = Bytes(hex: "D491DB16E7B1C39E86CB086B789F5419")!
  51. // let ct = try Twofish(key: key).encrypt(data: pt)
  52. // XCTAssertEqual(ct.hexa.uppercased(), "019F9809DE1711858FAAC3A3BA20FBC3", "Twofish: Encrypt Keysize=128 I=3 failed")
  53. //
  54. // pt = try Twofish(key: key).decrypt(data: ct)
  55. // XCTAssertEqual(pt.hexa.uppercased(), "D491DB16E7B1C39E86CB086B789F5419", "Twofish: Decrypt Keysize=128 I=3 failed")
  56. // }
  57. //
  58. // func testKey128_4() throws {
  59. // let key = Bytes(hex: "D491DB16E7B1C39E86CB086B789F5419")!
  60. // var pt = Bytes(hex: "019F9809DE1711858FAAC3A3BA20FBC3")!
  61. // let ct = try Twofish(key: key).encrypt(data: pt)
  62. // XCTAssertEqual(ct.hexa.uppercased(), "6363977DE839486297E661C6C9D668EB", "Twofish: Encrypt Keysize=128 I=4 failed")
  63. //
  64. // pt = try Twofish(key: key).decrypt(data: ct)
  65. // XCTAssertEqual(pt.hexa.uppercased(), "019F9809DE1711858FAAC3A3BA20FBC3", "Twofish: Decrypt Keysize=128 I=4 failed")
  66. // }
  67. //
  68. // func testKey128_5() throws {
  69. // let key = Bytes(hex: "019F9809DE1711858FAAC3A3BA20FBC3")!
  70. // var pt = Bytes(hex: "6363977DE839486297E661C6C9D668EB")!
  71. // let ct = try Twofish(key: key).encrypt(data: pt)
  72. // XCTAssertEqual(ct.hexa.uppercased(), "816D5BD0FAE35342BF2A7412C246F752", "Twofish: Encrypt Keysize=128 I=5 failed")
  73. //
  74. // pt = try Twofish(key: key).decrypt(data: ct)
  75. // XCTAssertEqual(pt.hexa.uppercased(), "6363977DE839486297E661C6C9D668EB", "Twofish: Decrypt Keysize=128 I=5 failed")
  76. // }
  77. //
  78. // func testKey128_6() throws {
  79. // let key = Bytes(hex: "6363977DE839486297E661C6C9D668EB")!
  80. // var pt = Bytes(hex: "816D5BD0FAE35342BF2A7412C246F752")!
  81. // let ct = try Twofish(key: key).encrypt(data: pt)
  82. // XCTAssertEqual(ct.hexa.uppercased(), "5449ECA008FF5921155F598AF4CED4D0", "Twofish: Encrypt Keysize=128 I=6 failed")
  83. //
  84. // pt = try Twofish(key: key).decrypt(data: ct)
  85. // XCTAssertEqual(pt.hexa.uppercased(), "816D5BD0FAE35342BF2A7412C246F752", "Twofish: Decrypt Keysize=128 I=6 failed")
  86. // }
  87. //
  88. // func testKey128_7() throws {
  89. // let key = Bytes(hex: "816D5BD0FAE35342BF2A7412C246F752")!
  90. // var pt = Bytes(hex: "5449ECA008FF5921155F598AF4CED4D0")!
  91. // let ct = try Twofish(key: key).encrypt(data: pt)
  92. // XCTAssertEqual(ct.hexa.uppercased(), "6600522E97AEB3094ED5F92AFCBCDD10", "Twofish: Encrypt Keysize=128 I=7 failed")
  93. //
  94. // pt = try Twofish(key: key).decrypt(data: ct)
  95. // XCTAssertEqual(pt.hexa.uppercased(), "5449ECA008FF5921155F598AF4CED4D0", "Twofish: Decrypt Keysize=128 I=7 failed")
  96. // }
  97. //
  98. // func testKey128_8() throws {
  99. // let key = Bytes(hex: "5449ECA008FF5921155F598AF4CED4D0")!
  100. // var pt = Bytes(hex: "6600522E97AEB3094ED5F92AFCBCDD10")!
  101. // let ct = try Twofish(key: key).encrypt(data: pt)
  102. // XCTAssertEqual(ct.hexa.uppercased(), "34C8A5FB2D3D08A170D120AC6D26DBFA", "Twofish: Encrypt Keysize=128 I=8 failed")
  103. //
  104. // pt = try Twofish(key: key).decrypt(data: ct)
  105. // XCTAssertEqual(pt.hexa.uppercased(), "6600522E97AEB3094ED5F92AFCBCDD10", "Twofish: Decrypt Keysize=128 I=8 failed")
  106. // }
  107. //
  108. // func testKey128_9() throws {
  109. // let key = Bytes(hex: "6600522E97AEB3094ED5F92AFCBCDD10")!
  110. // var pt = Bytes(hex: "34C8A5FB2D3D08A170D120AC6D26DBFA")!
  111. // let ct = try Twofish(key: key).encrypt(data: pt)
  112. // XCTAssertEqual(ct.hexa.uppercased(), "28530B358C1B42EF277DE6D4407FC591", "Twofish: Encrypt Keysize=128 I=9 failed")
  113. //
  114. // pt = try Twofish(key: key).decrypt(data: ct)
  115. // XCTAssertEqual(pt.hexa.uppercased(), "34C8A5FB2D3D08A170D120AC6D26DBFA", "Twofish: Decrypt Keysize=128 I=9 failed")
  116. // }
  117. //
  118. // func testKey128_10() throws {
  119. // let key = Bytes(hex: "34C8A5FB2D3D08A170D120AC6D26DBFA")!
  120. // var pt = Bytes(hex: "28530B358C1B42EF277DE6D4407FC591")!
  121. // let ct = try Twofish(key: key).encrypt(data: pt)
  122. // XCTAssertEqual(ct.hexa.uppercased(), "8A8AB983310ED78C8C0ECDE030B8DCA4", "Twofish: Encrypt Keysize=128 I=10 failed")
  123. //
  124. // pt = try Twofish(key: key).decrypt(data: ct)
  125. // XCTAssertEqual(pt.hexa.uppercased(), "28530B358C1B42EF277DE6D4407FC591", "Twofish: Decrypt Keysize=128 I=10 failed")
  126. // }
  127. //
  128. // func testKey192_1() throws {
  129. // let key = Bytes(hex: "000000000000000000000000000000000000000000000000")!
  130. // var pt = Bytes(hex: "00000000000000000000000000000000")!
  131. // let ct = try Twofish(key: key).encrypt(data: pt)
  132. // XCTAssertEqual(ct.hexa.uppercased(), "EFA71F788965BD4453F860178FC19101", "Twofish: Encrypt Keysize=192 I=1 failed")
  133. //
  134. // pt = try Twofish(key: key).decrypt(data: ct)
  135. // XCTAssertEqual(pt.hexa.uppercased(), "00000000000000000000000000000000", "Twofish: Decrypt Keysize=192 I=1 failed")
  136. // }
  137. //
  138. // func testKey192_2() throws {
  139. // let key = Bytes(hex: "000000000000000000000000000000000000000000000000")!
  140. // var pt = Bytes(hex: "EFA71F788965BD4453F860178FC19101")!
  141. // let ct = try Twofish(key: key).encrypt(data: pt)
  142. // XCTAssertEqual(ct.hexa.uppercased(), "88B2B2706B105E36B446BB6D731A1E88", "Twofish: Encrypt Keysize=192 I=2 failed")
  143. //
  144. // pt = try Twofish(key: key).decrypt(data: ct)
  145. // XCTAssertEqual(pt.hexa.uppercased(), "EFA71F788965BD4453F860178FC19101", "Twofish: Decrypt Keysize=192 I=2 failed")
  146. // }
  147. //
  148. // func testKey192_3() throws {
  149. // let key = Bytes(hex: "EFA71F788965BD4453F860178FC191010000000000000000")!
  150. // var pt = Bytes(hex: "88B2B2706B105E36B446BB6D731A1E88")!
  151. // let ct = try Twofish(key: key).encrypt(data: pt)
  152. // XCTAssertEqual(ct.hexa.uppercased(), "39DA69D6BA4997D585B6DC073CA341B2", "Twofish: Encrypt Keysize=192 I=3 failed")
  153. //
  154. // pt = try Twofish(key: key).decrypt(data: ct)
  155. // XCTAssertEqual(pt.hexa.uppercased(), "88B2B2706B105E36B446BB6D731A1E88", "Twofish: Decrypt Keysize=192 I=3 failed")
  156. // }
  157. //
  158. // func testKey192_4() throws {
  159. // let key = Bytes(hex: "88B2B2706B105E36B446BB6D731A1E88EFA71F788965BD44")!
  160. // var pt = Bytes(hex: "39DA69D6BA4997D585B6DC073CA341B2")!
  161. // let ct = try Twofish(key: key).encrypt(data: pt)
  162. // XCTAssertEqual(ct.hexa.uppercased(), "182B02D81497EA45F9DAACDC29193A65", "Twofish: Encrypt Keysize=192 I=4 failed")
  163. //
  164. // pt = try Twofish(key: key).decrypt(data: ct)
  165. // XCTAssertEqual(pt.hexa.uppercased(), "39DA69D6BA4997D585B6DC073CA341B2", "Twofish: Decrypt Keysize=192 I=4 failed")
  166. // }
  167. //
  168. // func testKey192_5() throws {
  169. // let key = Bytes(hex: "39DA69D6BA4997D585B6DC073CA341B288B2B2706B105E36")!
  170. // var pt = Bytes(hex: "182B02D81497EA45F9DAACDC29193A65")!
  171. // let ct = try Twofish(key: key).encrypt(data: pt)
  172. // XCTAssertEqual(ct.hexa.uppercased(), "7AFF7A70CA2FF28AC31DD8AE5DAAAB63", "Twofish: Encrypt Keysize=192 I=5 failed")
  173. //
  174. // pt = try Twofish(key: key).decrypt(data: ct)
  175. // XCTAssertEqual(pt.hexa.uppercased(), "182B02D81497EA45F9DAACDC29193A65", "Twofish: Decrypt Keysize=192 I=5 failed")
  176. // }
  177. //
  178. // func testKey192_6() throws {
  179. // let key = Bytes(hex: "182B02D81497EA45F9DAACDC29193A6539DA69D6BA4997D5")!
  180. // var pt = Bytes(hex: "7AFF7A70CA2FF28AC31DD8AE5DAAAB63")!
  181. // let ct = try Twofish(key: key).encrypt(data: pt)
  182. // XCTAssertEqual(ct.hexa.uppercased(), "D1079B789F666649B6BD7D1629F1F77E", "Twofish: Encrypt Keysize=192 I=6 failed")
  183. //
  184. // pt = try Twofish(key: key).decrypt(data: ct)
  185. // XCTAssertEqual(pt.hexa.uppercased(), "7AFF7A70CA2FF28AC31DD8AE5DAAAB63", "Twofish: Decrypt Keysize=192 I=6 failed")
  186. // }
  187. //
  188. // func testKey192_7() throws {
  189. // let key = Bytes(hex: "7AFF7A70CA2FF28AC31DD8AE5DAAAB63182B02D81497EA45")!
  190. // var pt = Bytes(hex: "D1079B789F666649B6BD7D1629F1F77E")!
  191. // let ct = try Twofish(key: key).encrypt(data: pt)
  192. // XCTAssertEqual(ct.hexa.uppercased(), "3AF6F7CE5BD35EF18BEC6FA787AB506B", "Twofish: Encrypt Keysize=192 I=7 failed")
  193. //
  194. // pt = try Twofish(key: key).decrypt(data: ct)
  195. // XCTAssertEqual(pt.hexa.uppercased(), "D1079B789F666649B6BD7D1629F1F77E", "Twofish: Decrypt Keysize=192 I=7 failed")
  196. // }
  197. //
  198. // func testKey192_8() throws {
  199. // let key = Bytes(hex: "D1079B789F666649B6BD7D1629F1F77E7AFF7A70CA2FF28A")!
  200. // var pt = Bytes(hex: "3AF6F7CE5BD35EF18BEC6FA787AB506B")!
  201. // let ct = try Twofish(key: key).encrypt(data: pt)
  202. // XCTAssertEqual(ct.hexa.uppercased(), "AE8109BFDA85C1F2C5038B34ED691BFF", "Twofish: Encrypt Keysize=192 I=8 failed")
  203. //
  204. // pt = try Twofish(key: key).decrypt(data: ct)
  205. // XCTAssertEqual(pt.hexa.uppercased(), "3AF6F7CE5BD35EF18BEC6FA787AB506B", "Twofish: Decrypt Keysize=192 I=8 failed")
  206. // }
  207. //
  208. // func testKey192_9() throws {
  209. // let key = Bytes(hex: "3AF6F7CE5BD35EF18BEC6FA787AB506BD1079B789F666649")!
  210. // var pt = Bytes(hex: "AE8109BFDA85C1F2C5038B34ED691BFF")!
  211. // let ct = try Twofish(key: key).encrypt(data: pt)
  212. // XCTAssertEqual(ct.hexa.uppercased(), "893FD67B98C550073571BD631263FC78", "Twofish: Encrypt Keysize=192 I=9 failed")
  213. //
  214. // pt = try Twofish(key: key).decrypt(data: ct)
  215. // XCTAssertEqual(pt.hexa.uppercased(), "AE8109BFDA85C1F2C5038B34ED691BFF", "Twofish: Decrypt Keysize=192 I=9 failed")
  216. // }
  217. //
  218. // func testKey192_10() throws {
  219. // let key = Bytes(hex: "AE8109BFDA85C1F2C5038B34ED691BFF3AF6F7CE5BD35EF1")!
  220. // var pt = Bytes(hex: "893FD67B98C550073571BD631263FC78")!
  221. // let ct = try Twofish(key: key).encrypt(data: pt)
  222. // XCTAssertEqual(ct.hexa.uppercased(), "16434FC9C8841A63D58700B5578E8F67", "Twofish: Encrypt Keysize=192 I=10 failed")
  223. //
  224. // pt = try Twofish(key: key).decrypt(data: ct)
  225. // XCTAssertEqual(pt.hexa.uppercased(), "893FD67B98C550073571BD631263FC78", "Twofish: Decrypt Keysize=192 I=10 failed")
  226. // }
  227. //
  228. // func testKey256_1() throws {
  229. // let key = Bytes(hex: "0000000000000000000000000000000000000000000000000000000000000000")!
  230. // var pt = Bytes(hex: "00000000000000000000000000000000")!
  231. // let ct = try Twofish(key: key).encrypt(data: pt)
  232. // XCTAssertEqual(ct.hexa.uppercased(), "57FF739D4DC92C1BD7FC01700CC8216F", "Twofish: Encrypt Keysize=256 I=1 failed")
  233. //
  234. // pt = try Twofish(key: key).decrypt(data: ct)
  235. // XCTAssertEqual(pt.hexa.uppercased(), "00000000000000000000000000000000", "Twofish: Decrypt Keysize=256 I=1 failed")
  236. // }
  237. //
  238. // func testKey256_2() throws {
  239. // let key = Bytes(hex: "0000000000000000000000000000000000000000000000000000000000000000")!
  240. // var pt = Bytes(hex: "57FF739D4DC92C1BD7FC01700CC8216F")!
  241. // let ct = try Twofish(key: key).encrypt(data: pt)
  242. // XCTAssertEqual(ct.hexa.uppercased(), "D43BB7556EA32E46F2A282B7D45B4E0D", "Twofish: Encrypt Keysize=256 I=2 failed")
  243. //
  244. // pt = try Twofish(key: key).decrypt(data: ct)
  245. // XCTAssertEqual(pt.hexa.uppercased(), "57FF739D4DC92C1BD7FC01700CC8216F", "Twofish: Decrypt Keysize=256 I=2 failed")
  246. // }
  247. //
  248. // func testKey256_3() throws {
  249. // let key = Bytes(hex: "57FF739D4DC92C1BD7FC01700CC8216F00000000000000000000000000000000")!
  250. // var pt = Bytes(hex: "D43BB7556EA32E46F2A282B7D45B4E0D")!
  251. // let ct = try Twofish(key: key).encrypt(data: pt)
  252. // XCTAssertEqual(ct.hexa.uppercased(), "90AFE91BB288544F2C32DC239B2635E6", "Twofish: Encrypt Keysize=256 I=3 failed")
  253. //
  254. // pt = try Twofish(key: key).decrypt(data: ct)
  255. // XCTAssertEqual(pt.hexa.uppercased(), "D43BB7556EA32E46F2A282B7D45B4E0D", "Twofish: Decrypt Keysize=256 I=3 failed")
  256. // }
  257. //
  258. // func testKey256_4() throws {
  259. // let key = Bytes(hex: "D43BB7556EA32E46F2A282B7D45B4E0D57FF739D4DC92C1BD7FC01700CC8216F")!
  260. // var pt = Bytes(hex: "90AFE91BB288544F2C32DC239B2635E6")!
  261. // let ct = try Twofish(key: key).encrypt(data: pt)
  262. // XCTAssertEqual(ct.hexa.uppercased(), "6CB4561C40BF0A9705931CB6D408E7FA", "Twofish: Encrypt Keysize=256 I=4 failed")
  263. //
  264. // pt = try Twofish(key: key).decrypt(data: ct)
  265. // XCTAssertEqual(pt.hexa.uppercased(), "90AFE91BB288544F2C32DC239B2635E6", "Twofish: Decrypt Keysize=256 I=4 failed")
  266. // }
  267. //
  268. // func testKey256_5() throws {
  269. // let key = Bytes(hex: "90AFE91BB288544F2C32DC239B2635E6D43BB7556EA32E46F2A282B7D45B4E0D")!
  270. // var pt = Bytes(hex: "6CB4561C40BF0A9705931CB6D408E7FA")!
  271. // let ct = try Twofish(key: key).encrypt(data: pt)
  272. // XCTAssertEqual(ct.hexa.uppercased(), "3059D6D61753B958D92F4781C8640E58", "Twofish: Encrypt Keysize=256 I=5 failed")
  273. //
  274. // pt = try Twofish(key: key).decrypt(data: ct)
  275. // XCTAssertEqual(pt.hexa.uppercased(), "6CB4561C40BF0A9705931CB6D408E7FA", "Twofish: Decrypt Keysize=256 I=5 failed")
  276. // }
  277. //
  278. // func testKey256_6() throws {
  279. // let key = Bytes(hex: "6CB4561C40BF0A9705931CB6D408E7FA90AFE91BB288544F2C32DC239B2635E6")!
  280. // var pt = Bytes(hex: "3059D6D61753B958D92F4781C8640E58")!
  281. // let ct = try Twofish(key: key).encrypt(data: pt)
  282. // XCTAssertEqual(ct.hexa.uppercased(), "E69465770505D7F80EF68CA38AB3A3D6", "Twofish: Encrypt Keysize=256 I=6 failed")
  283. //
  284. // pt = try Twofish(key: key).decrypt(data: ct)
  285. // XCTAssertEqual(pt.hexa.uppercased(), "3059D6D61753B958D92F4781C8640E58", "Twofish: Decrypt Keysize=256 I=6 failed")
  286. // }
  287. //
  288. // func testKey256_7() throws {
  289. // let key = Bytes(hex: "3059D6D61753B958D92F4781C8640E586CB4561C40BF0A9705931CB6D408E7FA")!
  290. // var pt = Bytes(hex: "E69465770505D7F80EF68CA38AB3A3D6")!
  291. // let ct = try Twofish(key: key).encrypt(data: pt)
  292. // XCTAssertEqual(ct.hexa.uppercased(), "5AB67A5F8539A4A5FD9F0373BA463466", "Twofish: Encrypt Keysize=256 I=7 failed")
  293. //
  294. // pt = try Twofish(key: key).decrypt(data: ct)
  295. // XCTAssertEqual(pt.hexa.uppercased(), "E69465770505D7F80EF68CA38AB3A3D6", "Twofish: Decrypt Keysize=256 I=7 failed")
  296. // }
  297. //
  298. // func testKey256_8() throws {
  299. // let key = Bytes(hex: "E69465770505D7F80EF68CA38AB3A3D63059D6D61753B958D92F4781C8640E58")!
  300. // var pt = Bytes(hex: "5AB67A5F8539A4A5FD9F0373BA463466")!
  301. // let ct = try Twofish(key: key).encrypt(data: pt)
  302. // XCTAssertEqual(ct.hexa.uppercased(), "DC096BCD99FC72F79936D4C748E75AF7", "Twofish: Encrypt Keysize=256 I=8 failed")
  303. //
  304. // pt = try Twofish(key: key).decrypt(data: ct)
  305. // XCTAssertEqual(pt.hexa.uppercased(), "5AB67A5F8539A4A5FD9F0373BA463466", "Twofish: Decrypt Keysize=256 I=8 failed")
  306. // }
  307. //
  308. // func testKey256_9() throws {
  309. // let key = Bytes(hex: "5AB67A5F8539A4A5FD9F0373BA463466E69465770505D7F80EF68CA38AB3A3D6")!
  310. // var pt = Bytes(hex: "DC096BCD99FC72F79936D4C748E75AF7")!
  311. // let ct = try Twofish(key: key).encrypt(data: pt)
  312. // XCTAssertEqual(ct.hexa.uppercased(), "C5A3E7CEE0F1B7260528A68FB4EA05F2", "Twofish: Encrypt Keysize=256 I=9 failed")
  313. //
  314. // pt = try Twofish(key: key).decrypt(data: ct)
  315. // XCTAssertEqual(pt.hexa.uppercased(), "DC096BCD99FC72F79936D4C748E75AF7", "Twofish: Decrypt Keysize=256 I=9 failed")
  316. // }
  317. //
  318. // func testKey256_10() throws {
  319. // let key = Bytes(hex: "DC096BCD99FC72F79936D4C748E75AF75AB67A5F8539A4A5FD9F0373BA463466")!
  320. // var pt = Bytes(hex: "C5A3E7CEE0F1B7260528A68FB4EA05F2")!
  321. // let ct = try Twofish(key: key).encrypt(data: pt)
  322. // XCTAssertEqual(ct.hexa.uppercased(), "43D5CEC327B24AB90AD34A79D0469151", "Twofish: Encrypt Keysize=256 I=10 failed")
  323. //
  324. // pt = try Twofish(key: key).decrypt(data: ct)
  325. // XCTAssertEqual(pt.hexa.uppercased(), "C5A3E7CEE0F1B7260528A68FB4EA05F2", "Twofish: Decrypt Keysize=256 I=10 failed")
  326. // }
  327. }