Created
May 17, 2020 12:54
-
-
Save 0xleastwood/37a753557bfe6807f52b1ce9027e7aa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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