Whisper API fixed (#3687)

* whisper: wnode updated for tests with geth

* whisper: updated processing of incoming messages

* whisper: symmetric encryption updated

* whisper: filter id type changed to enhance security

* whisper: allow filter without topic for asymmetric encryption

* whisper: POW updated

* whisper: logging updated

* whisper: spellchecker update

* whisper: error handling changed

* whisper: JSON field names fixed
This commit is contained in:
gluk256
2017-02-23 09:41:47 +01:00
committed by Jeffrey Wilcke
parent 555273495b
commit 29fac7de44
11 changed files with 182 additions and 111 deletions

View File

@ -34,7 +34,6 @@ func BenchmarkDeriveOneTimeKey(b *testing.B) {
}
}
//func TestEncryptionSym(b *testing.T) {
func BenchmarkEncryptionSym(b *testing.B) {
InitSingleTest()
@ -181,3 +180,33 @@ func BenchmarkDecryptionAsymInvalid(b *testing.B) {
}
}
}
func increment(x []byte) {
for i := 0; i < len(x); i++ {
x[i]++
if x[i] != 0 {
break
}
}
}
func BenchmarkPoW(b *testing.B) {
InitSingleTest()
params, err := generateMessageParams()
if err != nil {
b.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err)
}
params.Payload = make([]byte, 32)
params.PoW = 10.0
params.TTL = 1
for i := 0; i < b.N; i++ {
increment(params.Payload)
msg := NewSentMessage(params)
_, err := msg.Wrap(params)
if err != nil {
b.Fatalf("failed Wrap with seed %d: %s.", seed, err)
}
}
}