hyperledger-firefly / hyperledger-firefly/firefly

bug: tezos and eth eventstreams use invalid SHA256 invocation

Open
#1,678 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
602
Forks
246
Avg merge
18h 47m
Merged PRs (30d)
6

Description

### What happened?

https://github.com/search?q=repo%3Ahyperledger%2Ffirefly+sha256.New%28%29.Sum&type=code

`sha256.New().Sum` != `sha256.Sum256`. See https://go.dev/play/p/vSW0U3Hq4qk

I tried to make a PR but couldn't work out some test failures. Additionally, I don't have enough context to know whether this is a breaking change, so I'm just gonna file this issue instead.

### What did you expect to happen?

I expected vars like "unique hash" to have unique hashes in them. Instead, they have the raw plaintext with SHA256("") appended to the end.

### How can we reproduce it (as minimally and precisely as possible)?

Ya just gotta switch from `sha256.New().Sum` to `sha256.Sum256`. Note that you may need to throw that in a variable and then convert the byte array to byte slice with `[:]`.

See https://github.com/kubernetes-sigs/bom/pull/524 for a similar PR.

### Anything else we need to know?

_No response_

### OS version

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.