aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go29
1 files changed, 2 insertions, 27 deletions
diff --git a/main.go b/main.go
index 9e19d35..2f37773 100644
--- a/main.go
+++ b/main.go
@@ -3,31 +3,6 @@ package main
3import "fmt" 3import "fmt"
4 4
5func main() { 5func main() {
6 fmt.Println("=== secp256k1 from scratch ===") 6 fmt.Println("secp256k1 from scratch")
7 fmt.Println() 7 fmt.Println("Run: go test -v")
8
9 // Test field arithmetic with small numbers first
10 fmt.Println("Testing field arithmetic:")
11
12 a := NewFieldElementFromInt64(7)
13 b := NewFieldElementFromInt64(5)
14
15 fmt.Printf("a = %d\n", 7)
16 fmt.Printf("b = %d\n", 5)
17 fmt.Printf("a + b = %s (should end in ...c)\n", a.Add(b).String())
18 fmt.Printf("a - b = %s (should end in ...2)\n", a.Sub(b).String())
19 fmt.Printf("a * b = %s (should end in ...23, which is 35)\n", a.Mul(b).String())
20
21 // Test division: 10 / 5 = 2
22 ten := NewFieldElementFromInt64(10)
23 five := NewFieldElementFromInt64(5)
24 fmt.Printf("10 / 5 = %s (should end in ...2)\n", ten.Div(five).String())
25
26 // Test inverse: 5 * inverse(5) should = 1
27 inv := five.Inverse()
28 product := five.Mul(inv)
29 fmt.Printf("5 * inverse(5) = %s (should end in ...1)\n", product.String())
30
31 fmt.Println()
32 fmt.Println("Field arithmetic works!")
33} 8}