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
392 B

  1. package crypto
  2. import "github.com/ebfe/keccak"
  3. // quick keccak wrapper
  4. func Keccak256(data ...[]byte) (result Hash) {
  5. h := keccak.New256()
  6. for _, b := range data {
  7. h.Write(b)
  8. }
  9. r := h.Sum(nil)
  10. copy(result[:], r)
  11. return
  12. }
  13. func Keccak512(data ...[]byte) (result Hash) {
  14. h := keccak.New512()
  15. for _, b := range data {
  16. h.Write(b)
  17. }
  18. r := h.Sum(nil)
  19. copy(result[:], r)
  20. return
  21. }