From c14e8eda830099f30e1a9aeb2fd4fdcef9cca94a Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sun, 20 Nov 2022 16:07:03 -0500 Subject: lib: `invmod` -> `InvMod` --- lib/rsa.go | 4 ++-- lib/rsa_test.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/rsa.go b/lib/rsa.go index ae264b8..24cd709 100644 --- a/lib/rsa.go +++ b/lib/rsa.go @@ -33,7 +33,7 @@ func biCopy(a, b *big.Int) *big.Int { return a } -func invmod(a, n *big.Int) (*big.Int, error) { +func InvMod(a, n *big.Int) (*big.Int, error) { // Initialize. t0 := big.NewInt(0) t1 := big.NewInt(1) @@ -97,7 +97,7 @@ func RSAGenKey() (*RSAPair, error) { et := big.NewInt(0).Mul(p1, q1) // Totient `et`. // Calculate private key `d`. - d, err = invmod(e, et) + d, err = InvMod(e, et) if err != nil { continue // Inverse does not does. Try again. } diff --git a/lib/rsa_test.go b/lib/rsa_test.go index eee20c6..d26ee2c 100644 --- a/lib/rsa_test.go +++ b/lib/rsa_test.go @@ -12,9 +12,9 @@ func TestInvMod(t *testing.T) { a := big.NewInt(17) b := big.NewInt(3120) e := big.NewInt(2753) // Expected inverse. - i, err := invmod(a, b) + i, err := InvMod(a, b) if err != nil { - t.Errorf("invmod(%v,%v) failed: %v", a, b, err) + t.Errorf("InvMod(%v,%v) failed: %v", a, b, err) return } if i.Cmp(e) != 0 { @@ -24,9 +24,9 @@ func TestInvMod(t *testing.T) { a = big.NewInt(240) b = big.NewInt(47) e = big.NewInt(19) // Expected inverse. - i, err = invmod(a, b) + i, err = InvMod(a, b) if err != nil { - t.Errorf("invmod(%v,%v) failed: %v", a, b, err) + t.Errorf("InvMod(%v,%v) failed: %v", a, b, err) return } if i.Cmp(e) != 0 { @@ -36,9 +36,9 @@ func TestInvMod(t *testing.T) { a = big.NewInt(11) b = big.NewInt(26) e = big.NewInt(19) // Expected inverse. - i, err = invmod(a, b) + i, err = InvMod(a, b) if err != nil { - t.Errorf("invmod(%v,%v) failed: %v", a, b, err) + t.Errorf("InvMod(%v,%v) failed: %v", a, b, err) return } if i.Cmp(e) != 0 { @@ -48,9 +48,9 @@ func TestInvMod(t *testing.T) { a = big.NewInt(3) b = big.NewInt(7) e = big.NewInt(5) // Expected inverse. - i, err = invmod(a, b) + i, err = InvMod(a, b) if err != nil { - t.Errorf("invmod(%v,%v) failed: %v", a, b, err) + t.Errorf("InvMod(%v,%v) failed: %v", a, b, err) return } if i.Cmp(e) != 0 { -- cgit v1.2.3