Skein3Fish icon indicating copy to clipboard operation
Skein3Fish copied to clipboard

Doesn't compile with Go 1.

Open spikebike opened this issue 13 years ago • 2 comments

Seems like the new way to build go packages does not include make files. I restructured the tree and get the following error: $ go install crypto/threefish $ go install crypto/skein

crypto/skein

../../../gopkg/src/crypto/skein/skein.go:94: cannot use h (type *Skein) as type hash.Hash in return argument: *Skein does not implement hash.Hash (missing BlockSize method)

It looks pretty straight forward to add, but the go docs say: // BlockSize returns the hash's underlying block size. // The Write method must be able to accept any amount // of data, but it may operate more efficiently if all writes // are a multiple of the block size. BlockSize() int

What value should blocksize be set to?

spikebike avatar Apr 03 '12 05:04 spikebike

Hi,

I just waited for official Go V1 before I started to perform the resturcturing and testing. I'll do this the next few days because I have some Go packages that need attention.

I need to check the blocksize method because Skein has variable length blocksize, not a fixed length as standard hashes. Please give me some more day to fix it.

Best regards, Werner

Am 03.04.2012 07:42, schrieb Bill Broadley:

Seems like the new way to build go packages does not include make files. I restructured the tree and get the following error: $ go install crypto/threefish $ go install crypto/skein

crypto/skein

../../../gopkg/src/crypto/skein/skein.go:99: cannot use h (type *Skein) as type hash.Hash in return argument: *Skein does not implement hash.Hash (missing BlockSize method)

It looks pretty straight forward to add, but the go docs say: // BlockSize returns the hash's underlying block size. // The Write method must be able to accept any amount // of data, but it may operate more efficiently if all writes // are a multiple of the block size. BlockSize() int

What value should blocksize be set to?


Reply to this email directly or view it on GitHub: https://github.com/wernerd/Skein3Fish/issues/1

wernerd avatar Apr 03 '12 12:04 wernerd

On 04/03/2012 05:52 AM, wernerd wrote:

Hi,

I just waited for official Go V1 before I started to perform the restructuring and testing.

Very sensible.

I'll do this the next few days because I have some Go packages that need attention.

I've made all the changes necessary, I don't have access to the git clone at the moment, but I think it's mainly:

  • OS.error -> error
  • skein.go: func (s *Skein) BlockSize() int { return 64 }

I need to check the blocksize method because Skein has variable length blocksize, not a fixed length as standard hashes. Please give me some more day to fix it.

Well there's no impact as far as I can go, just a little helper so that the person writing the hash can provide feedback to the user for the ideal write size for good performance. Write is defined to take any size input, so maybe just set it to whatever knee in the curve for reasonable efficiency.

I don't see any reason not to find it experimentally, start a 1 and go up to 65536 and see what the minimum size is that provides 90% of peak performance or similar.

Once I made the changes I did: $ mkdir ~/gopkg $ export GOPKG=~/gopkg $ cd tmp/git/Skein3Fish/go/src/pkg $ cp -rp * $GOPKG/src/crypto $ go install crypto/threefish $ go install crypto/skein $ go test crypto/threefish $ go test crypto/skein

Oh, I had to change the path to the test vector so I changed that to data/skein_golden_kat.txt and put the data directory into $GOPKG/src/crypto/skein

I'm not advocating the above as the best way to do it, but it is not a bad place to start. If I can help in any way let me know. Not sure how "go" it is, but I could make a script that does the above, I've not seen any well documented examples of libraries that support multiple languages.

spikebike avatar Apr 03 '12 17:04 spikebike