Skip to content

Commit

Permalink
add code I could have used and correctly spell hash
Browse files Browse the repository at this point in the history
  • Loading branch information
devries committed Dec 14, 2023
1 parent a1916f5 commit 65cb714
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,25 @@ the third run of my solution after compilation on my Raspberry Pi.

So far I have not used any AI generated subroutines in my code. Today may have
been a good day to try. I could have asked something like "write a function in
go that calculates the has of a slice of int32s." While programming it seems
like I don't really want to shift gears to ask AI for help.
go that calculates the hash of a slice of int32s." Having just asked, bing
generated the following code:

```go
import (
"crypto/sha256"
"encoding/binary"
)

func HashInt32Slice(s []int32) [32]byte {
h := sha256.New()
for _, i := range s {
b := make([]byte, 4)
binary.LittleEndian.PutUint32(b, uint32(i))
h.Write(b)
}
return h.Sum(nil)
}
```

While programming it seems like I don't really want to shift gears to ask AI
for help.

0 comments on commit 65cb714

Please sign in to comment.