fuzz.go (413B)
1 // +build gofuzz 2 3 package securecookie 4 5 var hashKey = []byte("very-secret12345") 6 var blockKey = []byte("a-lot-secret1234") 7 var s = New(hashKey, blockKey) 8 9 type Cookie struct { 10 B bool 11 I int 12 S string 13 } 14 15 func Fuzz(data []byte) int { 16 datas := string(data) 17 var c Cookie 18 if err := s.Decode("fuzz", datas, &c); err != nil { 19 return 0 20 } 21 if _, err := s.Encode("fuzz", c); err != nil { 22 panic(err) 23 } 24 return 1 25 }