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.

31 lines
791 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 skein1024
  6. func bytesToBlock(block *[16]uint64, src []byte) {
  7. for i := range block {
  8. j := i * 8
  9. block[i] = uint64(src[j]) | uint64(src[j+1])<<8 | uint64(src[j+2])<<16 |
  10. uint64(src[j+3])<<24 | uint64(src[j+4])<<32 | uint64(src[j+5])<<40 |
  11. uint64(src[j+6])<<48 | uint64(src[j+7])<<56
  12. }
  13. }
  14. func blockToBytes(dst []byte, block *[16]uint64) {
  15. i := 0
  16. for _, v := range block {
  17. dst[i] = byte(v)
  18. dst[i+1] = byte(v >> 8)
  19. dst[i+2] = byte(v >> 16)
  20. dst[i+3] = byte(v >> 24)
  21. dst[i+4] = byte(v >> 32)
  22. dst[i+5] = byte(v >> 40)
  23. dst[i+6] = byte(v >> 48)
  24. dst[i+7] = byte(v >> 56)
  25. i += 8
  26. }
  27. }