Skip to content

Commit

Permalink
more data as hash needed test
Browse files Browse the repository at this point in the history
  • Loading branch information
bobiverse committed Apr 12, 2024
1 parent 74a3cbf commit dc55308
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/bobiverse/hashtrace

go 1.21
go 1.22.2

require golang.org/x/crypto v0.4.0
require golang.org/x/crypto v0.22.0

require golang.org/x/sys v0.3.0 // indirect
require golang.org/x/sys v0.19.0 // indirect
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2 changes: 1 addition & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func hashRIPEMD160(s string) string {
}

func permutations(input []string) [][]string {
if len(input) > 4 {
if len(input) > 10 {
log.Fatal("Too many permutations")
}
var result [][]string
Expand Down
17 changes: 17 additions & 0 deletions t_TrickyHash_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "testing"

func TestTrickyHash(t *testing.T) {
testcases := []*TestCase{
{ExpectedHash: "b5324104beefb851ff", Data: []string{"a", "b", "c", "d", "e", "f"}, Separators: nil}, // hashed "ac" but given data more
}

for _, tc := range testcases {
_, _, err := CrackHash(tc.ExpectedHash, tc.Data, tc.Separators)
if err != nil {
t.Fatalf("`%s` should be cracked by given plain `%q` data", tc.ExpectedHash, tc.Data)
}
}

}

0 comments on commit dc55308

Please sign in to comment.