You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
413 B
26 lines
413 B
8 years ago
|
// +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
|
||
|
}
|