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.

28 lines
655 B

  1. package keccak
  2. import (
  3. "bytes"
  4. "testing"
  5. )
  6. func TestSHAKE128(t *testing.T) {
  7. for i := range shaketests {
  8. h := NewSHAKE128(len(shaketests[i].output128))
  9. h.Write(shaketests[i].msg)
  10. d := h.Sum(nil)
  11. if !bytes.Equal(d, shaketests[i].output128) {
  12. t.Errorf("testcase SHAKE128 %d: expected %x got %x", i, shaketests[i].output128, d)
  13. }
  14. }
  15. }
  16. func TestSHAKE256(t *testing.T) {
  17. for i := range shaketests {
  18. h := NewSHAKE256(len(shaketests[i].output256))
  19. h.Write(shaketests[i].msg)
  20. d := h.Sum(nil)
  21. if !bytes.Equal(d, shaketests[i].output256) {
  22. t.Errorf("testcase SHAKE256 %d: expected %x got %x", i, shaketests[i].output256, d)
  23. }
  24. }
  25. }