Kris Kwiatkowski 5 лет назад
Родитель
Сommit
44f93c31f2
3 измененных файлов: 8 добавлений и 19 удалений
  1. +5
    -8
      README.md
  2. +0
    -10
      arith.go
  3. +3
    -1
      sike_test.go

+ 5
- 8
README.md Просмотреть файл

@@ -1,20 +1,17 @@
# Supersingular Isogeny Key Encapsulation

Repository stores implementation of SIKE based on field p503 in Go. It is small and condese implementation.

Implementation uses HMAC instead of cSHAKE.
Repository stores Go's implementation of SIKE based on field p503. Implementation uses HMAC instead of cSHAKE. Implementation is quite slow, as the main focus here to keep code base
condensed rather than fast.

## Speed

This version is highly not optimized, it doesn't use any assembly.

```
> go test -run=. -bench=.
goos: linux
goarch: amd64
BenchmarkKeygen-4 1000000 1204 ns/op
BenchmarkEncaps-4 20 54651908 ns/op
BenchmarkDecaps-4 20 60516975 ns/op
BenchmarkKeygen-4 50 32298894 ns/op
BenchmarkEncaps-4 20 53348330 ns/op
BenchmarkDecaps-4 20 64073853 ns/op
PASS
ok _/home/hdc/repos/go-sike-p503 5.550s
```

+ 0
- 10
arith.go Просмотреть файл

@@ -357,16 +357,6 @@ func inv(dest, x *Fp2) {
a := &x.A
b := &x.B

// We want to compute
//
// 1 1 (a - bi) (a - bi)
// -------- = -------- -------- = -----------
// (a + bi) (a + bi) (a - bi) (a^2 + b^2)
//
// Letting c = 1/(a^2 + b^2), this is
//
// 1/(a+bi) = a*c - b*ci.

fpMul(&asq, a, a) // = a*a*R*R
fpMul(&bsq, b, b) // = b*b*R*R
fp2Add(&asq, &asq, &bsq) // = (a^2 + b^2)*R*R


+ 3
- 1
sike_test.go Просмотреть файл

@@ -620,8 +620,10 @@ func TestDecapsulation(t *testing.T) {

func BenchmarkKeygen(b *testing.B) {
prv := NewPrivateKey(KeyVariant_SIKE)
prv.Generate(rand.Reader)

for n := 0; n < b.N; n++ {
prv.Generate(rand.Reader)
prv.GeneratePublicKey()
}
}



Загрузка…
Отмена
Сохранить