diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 545066e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: required -dist: trusty -language: go - -os: -- linux -- osx - -osx_image: xcode7.2 - -go: -- 1.6 -- 1.5 - -env: -- ARCH=x86_64 -- ARCH=i686 - -script: -- diff -au <(gofmt -d .) <(printf "") -- go test -race -v ./... diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 77595fe..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -# Platform. -platform: x64 - -clone_folder: c:\gopath\src\github.com\minio\blake2b-simd - -# environment variables -environment: - GOPATH: c:\gopath - GO15VENDOREXPERIMENT: 1 - -# scripts that run after cloning repository -install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - - go version - - go env - -# to run your custom scripts instead of automatic MSBuild -build_script: - - go test . - - go test -race . - -# to disable automatic tests -test: off - -# to disable deployment -deploy: off diff --git a/blake2b.go b/blake2b.go index 538466a..b7d5a97 100644 --- a/blake2b.go +++ b/blake2b.go @@ -269,14 +269,7 @@ func (d *digest) checkSum() [Size]byte { var out [Size]byte j := 0 for _, s := range d.h[:(d.size-1)/8+1] { - out[j+0] = byte(s >> 0) - out[j+1] = byte(s >> 8) - out[j+2] = byte(s >> 16) - out[j+3] = byte(s >> 24) - out[j+4] = byte(s >> 32) - out[j+5] = byte(s >> 40) - out[j+6] = byte(s >> 48) - out[j+7] = byte(s >> 56) + binary.LittleEndian.PutUint64(out[j:j+8], s) j += 8 } return out diff --git a/compressAvx2_amd64.go b/compressAvx2_amd64.go index ec53599..0b7d484 100644 --- a/compressAvx2_amd64.go +++ b/compressAvx2_amd64.go @@ -1,5 +1,5 @@ -//+build !noasm -//+build !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine /* * Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compressAvx2_amd64.s b/compressAvx2_amd64.s index 24df234..8be6ddc 100644 --- a/compressAvx2_amd64.s +++ b/compressAvx2_amd64.s @@ -1,4 +1,5 @@ -//+build !noasm !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine // // Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compressAvx_amd64.go b/compressAvx_amd64.go index cfa12c0..91901db 100644 --- a/compressAvx_amd64.go +++ b/compressAvx_amd64.go @@ -1,5 +1,5 @@ -//+build !noasm -//+build !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine /* * Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compressAvx_amd64.s b/compressAvx_amd64.s index f68e173..5dea5d8 100644 --- a/compressAvx_amd64.s +++ b/compressAvx_amd64.s @@ -1,4 +1,5 @@ -//+build !noasm !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine // // Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compressSse_amd64.go b/compressSse_amd64.go index d539a7a..4eebf76 100644 --- a/compressSse_amd64.go +++ b/compressSse_amd64.go @@ -1,5 +1,5 @@ -//+build !noasm -//+build !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine /* * Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compressSse_amd64.s b/compressSse_amd64.s index 6f31c94..b51b14b 100644 --- a/compressSse_amd64.s +++ b/compressSse_amd64.s @@ -1,4 +1,5 @@ -//+build !noasm !appengine +//go:build !noasm && !appengine +// +build !noasm,!appengine // // Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/compress_generic.go b/compress_generic.go index e9e16e8..19ffda9 100644 --- a/compress_generic.go +++ b/compress_generic.go @@ -7,6 +7,8 @@ package blake2b +import "encoding/binary" + func compressGeneric(d *digest, p []uint8) { h0, h1, h2, h3, h4, h5, h6, h7 := d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] @@ -30,9 +32,7 @@ func compressGeneric(d *digest, p []uint8) { j := 0 var m [16]uint64 for i := range m { - m[i] = uint64(p[j]) | uint64(p[j+1])<<8 | uint64(p[j+2])<<16 | - uint64(p[j+3])<<24 | uint64(p[j+4])<<32 | uint64(p[j+5])<<40 | - uint64(p[j+6])<<48 | uint64(p[j+7])<<56 + m[i] = binary.LittleEndian.Uint64(p[j : j+8]) j += 8 } diff --git a/compress_noasm.go b/compress_noasm.go index d3c6758..9c94594 100644 --- a/compress_noasm.go +++ b/compress_noasm.go @@ -1,4 +1,5 @@ -//+build !amd64 noasm appengine +//go:build !amd64 || noasm || appengine +// +build !amd64 noasm appengine /* * Minio Cloud Storage, (C) 2016 Minio, Inc. diff --git a/cpuid.go b/cpuid.go index a9f9550..30f3ee1 100644 --- a/cpuid.go +++ b/cpuid.go @@ -1,3 +1,4 @@ +//go:build (386 && !gccgo) || (amd64 && !gccgo) // +build 386,!gccgo amd64,!gccgo // Copyright 2016 Frank Wessels diff --git a/cpuid_386.s b/cpuid_386.s index fa38814..bc2da9b 100644 --- a/cpuid_386.s +++ b/cpuid_386.s @@ -1,7 +1,8 @@ -// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. - +//go:build 386 && !gccgo // +build 386,!gccgo +// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. + // func cpuid(op uint32) (eax, ebx, ecx, edx uint32) TEXT ·cpuid(SB), 7, $0 XORL CX, CX diff --git a/cpuid_amd64.s b/cpuid_amd64.s index fb45a65..b651034 100644 --- a/cpuid_amd64.s +++ b/cpuid_amd64.s @@ -1,7 +1,8 @@ -// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. - +//go:build amd64 && !gccgo // +build amd64,!gccgo +// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. + // func cpuid(op uint32) (eax, ebx, ecx, edx uint32) TEXT ·cpuid(SB), 7, $0 XORQ CX, CX diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b151cf4 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/fumiama/blake2b-simd + +go 1.17