fuzz.go 413 B

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