MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / testPrecondition

Function testPrecondition

cipher/rsa/rsa_test.go:38–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func testPrecondition(t *testing.T) (int64, int64, int64) {
39 // Both prime numbers
40 t.Helper()
41 p := int64(61)
42 q := int64(53)
43 n := p * q
44 delta := lcm.Lcm(p-1, q-1)
45 e := int64(17) // Coprime with delta
46 if gcd.Recursive(e, delta) != 1 {
47 t.Fatal("something went wrong: prime numbers are chosen statically and it shouldn't fail at this stage")
48 }
49 d, err := modular.Inverse(e, delta)
50 if err != nil {
51 t.Fatalf("something went wrong: problem with %q: %v", "modular.Inverse", err)
52 }
53 return e, d, n
54}
55
56func TestEncryptDecrypt(t *testing.T) {
57 for _, test := range rsaTestData {

Callers 2

TestEncryptDecryptFunction · 0.85
FuzzRsaFunction · 0.85

Calls 3

LcmFunction · 0.92
RecursiveFunction · 0.92
InverseFunction · 0.92

Tested by

no test coverage detected