mirror of
https://github.com/fumiama/blake2b-simd.git
synced 2026-06-05 02:00:26 +08:00
``` $ go test -run=NONE -bench . PASS BenchmarkHash64-4 1000000 1036 ns/op 61.77 MB/s BenchmarkHash128-4 2000000 801 ns/op 159.67 MB/s BenchmarkHash1K-4 500000 2464 ns/op 415.53 MB/s BenchmarkHash8K-4 200000 11212 ns/op 730.60 MB/s BenchmarkHash32K-4 30000 40766 ns/op 803.80 MB/s BenchmarkHash128K-4 10000 163170 ns/op 803.28 MB/s ok github.com/minio/blake2b-simd 10.298s ```
29 lines
841 B
Go
29 lines
841 B
Go
/*
|
|
* Minio Cloud Storage, (C) 2016 Minio, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package blake2b
|
|
|
|
func compress(d *digest, p []uint8) {
|
|
// Verifies if AVX2 or AVX is available, use optimized code path.
|
|
if avx2 {
|
|
compressAVX2(d, p)
|
|
} else if avx {
|
|
compressAVX(d, p)
|
|
} else {
|
|
compressGeneric(d, p)
|
|
}
|
|
}
|