github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/crypto/sha3/xor_generic.go (about)

     1  
     2  //此源码被清华学神尹成大魔王专业翻译分析并修改
     3  //尹成QQ77025077
     4  //尹成微信18510341407
     5  //尹成所在QQ群721929980
     6  //尹成邮箱 yinc13@mails.tsinghua.edu.cn
     7  //尹成毕业于清华大学,微软区块链领域全球最有价值专家
     8  //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
     9  //版权所有2015 The Go作者。版权所有。
    10  //此源代码的使用受BSD样式的控制
    11  //可以在许可文件中找到的许可证。
    12  
    13  package sha3
    14  
    15  import "encoding/binary"
    16  
    17  //xoringenericxor将buf中的字节转换为状态;它
    18  //makes no non-portable assumptions about memory layout
    19  //或对齐。
    20  func xorInGeneric(d *state, buf []byte) {
    21  	n := len(buf) / 8
    22  
    23  	for i := 0; i < n; i++ {
    24  		a := binary.LittleEndian.Uint64(buf)
    25  		d.a[i] ^= a
    26  		buf = buf[8:]
    27  	}
    28  }
    29  
    30  //copyoutgeneric将ulint64复制到字节缓冲区。
    31  func copyOutGeneric(d *state, b []byte) {
    32  	for i := 0; len(b) >= 8; i++ {
    33  		binary.LittleEndian.PutUint64(b, d.a[i])
    34  		b = b[8:]
    35  	}
    36  }