Skip to content

Commit

Permalink
fix diffstr len 1
Browse files Browse the repository at this point in the history
  • Loading branch information
xqdoo00o committed May 1, 2024
1 parent a288523 commit 89a038c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func generateAnswer(seed string, diff string, hardware int, proxy string) (strin
return "wQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D" + base64.StdEncoding.EncodeToString([]byte(`"`+seed+`"`)), 0
}
config := getConfig(hardware)
diffLen := len(diff) / 2
diffLen := len(diff)
hasher := sha3.New512()
for i := 0; i < 1000000; i++ {
config[3] = i
Expand All @@ -303,7 +303,7 @@ func generateAnswer(seed string, diff string, hardware int, proxy string) (strin
hasher.Write([]byte(seed + base))
hash := hasher.Sum(nil)
hasher.Reset()
if hex.EncodeToString(hash[:diffLen]) <= diff {
if hex.EncodeToString(hash[:diffLen])[:diffLen] <= diff {
return base, config[0].(int)
}
}
Expand Down

0 comments on commit 89a038c

Please sign in to comment.