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.

27 lines
592 B

  1. // Copyright (c) 2016 Andreas Auernhammer. All rights reserved.
  2. // Use of this source code is governed by a license that can be
  3. // found in the LICENSE file.
  4. // +build amd64
  5. package skein256
  6. import "unsafe"
  7. func bytesToBlock(block *[4]uint64, src []byte) {
  8. srcPtr := (*[4]uint64)(unsafe.Pointer(&src[0]))
  9. block[0] = srcPtr[0]
  10. block[1] = srcPtr[1]
  11. block[2] = srcPtr[2]
  12. block[3] = srcPtr[3]
  13. }
  14. func blockToBytes(dst []byte, block *[4]uint64) {
  15. dstPtr := (*[4]uint64)(unsafe.Pointer(&dst[0]))
  16. dstPtr[0] = block[0]
  17. dstPtr[1] = block[1]
  18. dstPtr[2] = block[2]
  19. dstPtr[3] = block[3]
  20. }