mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
add SSE3 version for 2 chunks
This commit is contained in:
@@ -5,4 +5,5 @@
|
||||
extern void sha256_4_avx(unsigned char* output, const unsigned char* input, uint64_t blocks);
|
||||
extern void sha256_8_avx2(unsigned char* output, const unsigned char* input, uint64_t blocks);
|
||||
extern void sha256_shani(unsigned char* output, const unsigned char* input, uint64_t blocks);
|
||||
extern void sha256_1_avx(unsigned char* output, const unsigned char* input);
|
||||
#endif
|
||||
|
||||
@@ -143,3 +143,7 @@ func PotuzHasherShani(dst []byte, inp []byte, count uint64) {
|
||||
func PotuzHasherAVX2(dst []byte, inp []byte, count uint64) {
|
||||
C.sha256_8_avx2((*C.uchar)(&dst[0]), (*C.uchar)(&inp[0]), C.ulong(count))
|
||||
}
|
||||
|
||||
func PotuzHasher2Chunks(dst []byte, inp []byte) {
|
||||
C.sha256_1_avx((*C.uchar)(&dst[0]), (*C.uchar)(&inp[0]))
|
||||
}
|
||||
|
||||
@@ -124,3 +124,13 @@ func TestCustomHash_Avx2(t *testing.T) {
|
||||
hash.PotuzHasherAVX2(root, hash0, 1)
|
||||
assert.DeepEqual(t, hashOf1[:], root)
|
||||
}
|
||||
|
||||
func TestCustomHash_SSE(t *testing.T) {
|
||||
hash0 := make([]byte, 64)
|
||||
root := make([]byte, 32)
|
||||
|
||||
hashOf1 := [32]byte{245, 165, 253, 66, 209, 106, 32, 48, 39, 152, 239, 110, 211, 9, 151, 155, 67, 0, 61, 35, 32, 217, 240, 232, 234, 152, 49, 169, 39, 89, 251, 75}
|
||||
|
||||
hash.PotuzHasher2Chunks(root, hash0)
|
||||
assert.DeepEqual(t, hashOf1[:], root)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user