You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
753 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build 386,!gccgo,!appengine
  5. package blake2s
  6. import "golang.org/x/sys/cpu"
  7. var (
  8. useSSE4 = false
  9. useSSSE3 = cpu.X86.HasSSSE3
  10. useSSE2 = cpu.X86.HasSSE2
  11. )
  12. //go:noescape
  13. func hashBlocksSSE2(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  14. //go:noescape
  15. func hashBlocksSSSE3(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte)
  16. func hashBlocks(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) {
  17. switch {
  18. case useSSSE3:
  19. hashBlocksSSSE3(h, c, flag, blocks)
  20. case useSSE2:
  21. hashBlocksSSE2(h, c, flag, blocks)
  22. default:
  23. hashBlocksGeneric(h, c, flag, blocks)
  24. }
  25. }