Initial commit

This commit is contained in:
Smaug123
2023-02-04 19:55:38 +00:00
commit ef9c792e64
29 changed files with 71565 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
namespace CipherSuite.Test
open NUnit.Framework
open CipherSuite
open FsUnitTyped
[<TestFixture>]
module TestAffine =
[<Test>]
let ``Examples, Challenge 1`` () =
let key, plain, fitness = Affine.crack Examples.challenge1A
plain.StartsWith "I WAS HOPING I WOULD FIND YOU HERE" |> shouldEqual true
// Note: this is the inverse of the correct key
key |> shouldEqual (1, 19)
let key, plain, fitness = Affine.crack Examples.challenge1B
plain.StartsWith "DEAR MS FRANK," |> shouldEqual true
key |> shouldEqual (1, 7)
[<Test>]
let ``Examples, Challenge 2`` () =
let key, plain, fitness = Affine.crack Examples.challenge2A
plain.StartsWith "I MANAGED TO TRACE JADE/JODIE TO A SUITE" |> shouldEqual true
// Note: this is the inverse of the correct key
key |> shouldEqual (21, 6)
let key, plain, fitness = Affine.crack Examples.challenge2B
plain.StartsWith "DEAR MS FRANK," |> shouldEqual true
key |> shouldEqual (3, 11)
[<Test>]
let ``Examples, Challenge 3`` () =
let key, plain, fitness = Affine.crack Examples.challenge3A
plain.StartsWith "JODIE ISMAK INGTH ISVER YEASY FORME HERRE CENTC"
|> shouldEqual true
// Note: this is the inverse of the correct key
key |> shouldEqual (1, 18)