Wycheproof

main

Wycheproof for Swift
0to10/wycheproof-swift

Wycheproof for Swift

This repository "wraps" the excellent Project Wycheproof repository, and intends to make it easier to incorporate testing against known attacks, specification inconsistencies, and other various implementation bugs in Swift projects.

Using Wycheproof for Swift

Wycheproof for Swift is available as a Swift Package Manager package. To use it, add the following dependency in your Package.swift:

.package(url: "https://github.com/0to10/wycheproof-swift.git", branch: "main"),

and to your target, add Wycheproof to your dependencies (this will be testTarget in most cases):

.product(name: "Wycheproof", package: "wycheproof-swift")

You can then import Wycheproof to get access this projects functionality.

Basic usage

Wycheproof for Swift allows you to easily load test vectors in your unit tests. The repository itself does not contain any structs for decoding specific test vectors, but you can easily define your own.

struct AesGcmTest: Wycheproof.Test {
    public let tcId: Int
    public let comment: String?
    public let result: Wycheproof.TestResult
    public let flags: [String]

    public let key: String
    public let iv: String
    public let aad: String
    public let msg: String
    public let ct: String
    public let tag: String
}

Then use the defined struct in your test as shown below:

import Testing
import Wycheproof

// more imports

struct ExampleTests {

    @Test(
        arguments: try Wycheproof.loadTests(
            AesGcmTest.self,
            named: "testvectors_v1/aes_gcm_test"
        )
    )
    func testFunction(args: AesGcmTest) throws {
        // test logic
    }

}

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Jul 20 2026 10:56:00 GMT-0900 (Hawaii-Aleutian Daylight Time)