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.

51 lines
1.1 KiB

  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 skein1024
  6. import "unsafe"
  7. func bytesToBlock(block *[16]uint64, src []byte) {
  8. srcPtr := (*[16]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. block[4] = srcPtr[4]
  14. block[5] = srcPtr[5]
  15. block[6] = srcPtr[6]
  16. block[7] = srcPtr[7]
  17. block[8] = srcPtr[8]
  18. block[9] = srcPtr[9]
  19. block[10] = srcPtr[10]
  20. block[11] = srcPtr[11]
  21. block[12] = srcPtr[12]
  22. block[13] = srcPtr[13]
  23. block[14] = srcPtr[14]
  24. block[15] = srcPtr[15]
  25. }
  26. func blockToBytes(dst []byte, block *[16]uint64) {
  27. dstPtr := (*[16]uint64)(unsafe.Pointer(&dst[0]))
  28. dstPtr[0] = block[0]
  29. dstPtr[1] = block[1]
  30. dstPtr[2] = block[2]
  31. dstPtr[3] = block[3]
  32. dstPtr[4] = block[4]
  33. dstPtr[5] = block[5]
  34. dstPtr[6] = block[6]
  35. dstPtr[7] = block[7]
  36. dstPtr[8] = block[8]
  37. dstPtr[9] = block[9]
  38. dstPtr[10] = block[10]
  39. dstPtr[11] = block[11]
  40. dstPtr[12] = block[12]
  41. dstPtr[13] = block[13]
  42. dstPtr[14] = block[14]
  43. dstPtr[15] = block[15]
  44. }