go implementation of CodeDweller/mishmash.hpp/cpp
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.

mishmash_test.go 603B

3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
123456789101112131415161718192021222324252627282930
  1. package mishmash
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestMishmash(t *testing.T) {
  7. want := "9d923077"
  8. hash, _ := Mishmash([]byte("google.com"))
  9. got := fmt.Sprintf("%08x", hash)
  10. if want != got {
  11. t.Error("Parse() = got", got, "want", want)
  12. } else {
  13. fmt.Println("TestMishmash Passed")
  14. }
  15. }
  16. func TestSecondHash(t *testing.T) {
  17. want := "65df1304"
  18. _, accum := Mishmash([]byte("google.com"))
  19. hash, accum := Mishmash([]byte("google.com"), accum)
  20. got := fmt.Sprintf("%08x", hash)
  21. if want != got {
  22. t.Error("Parse() = got", got, "want", want)
  23. } else {
  24. fmt.Println("TestSecondHash Passed")
  25. }
  26. }