diff options
author | Kamil Kisiel <kamil@kamilkisiel.net> | 2015-08-18 23:59:03 +0300 |
---|---|---|
committer | Kamil Kisiel <kamil@kamilkisiel.net> | 2015-08-18 23:59:32 +0300 |
commit | 45e43d5d12f051fe5e9f538f0f237d58016b6866 (patch) | |
tree | ced0870978ee4136fef4ca3acf06ac8242494614 /fuzz.go | |
parent | 95995b243b00d085c7068909df0f833b343a3215 (diff) |
Added fuzz testing facilities.
Diffstat (limited to 'fuzz.go')
-rw-r--r-- | fuzz.go | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +// +build gofuzz + +package securecookie + +var hashKey = []byte("very-secret12345") +var blockKey = []byte("a-lot-secret1234") +var s = New(hashKey, blockKey) + +type Cookie struct { + B bool + I int + S string +} + +func Fuzz(data []byte) int { + datas := string(data) + var c Cookie + if err := s.Decode("fuzz", datas, &c); err != nil { + return 0 + } + if _, err := s.Encode("fuzz", c); err != nil { + panic(err) + } + return 1 +} |