Skip to content

Instantly share code, notes, and snippets.

@0xleastwood
Created May 17, 2020 12:54
Show Gist options
  • Save 0xleastwood/37a753557bfe6807f52b1ce9027e7aa8 to your computer and use it in GitHub Desktop.
Save 0xleastwood/37a753557bfe6807f52b1ce9027e7aa8 to your computer and use it in GitHub Desktop.
func Fuzz(data []byte) int {
kp := key.NewKeyPair("127.0.0.1")
h := sha256.New
cipher, err := Encrypt(key.KeyGroup, h, kp.Public.Key, data)
if err != nil {
return 0
}
plain, err := Decrypt(key.KeyGroup, h, kp.Key, cipher)
res := bytes.Compare(data, plain)
if err != nil {
panic(err)
} else if res != 0 {
panic("Error: Data cannot be decrypted")
}
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment