1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-10 01:40:43 +00:00
OpenDiablo2/d2data/mpq/CryptoBuff.go
2019-11-10 03:36:53 -05:00

21 lines
519 B
Go

package mpq
// CryptoBuffer contains the crypto bytes for filename hashing
var CryptoBuffer [0x500]uint32
// InitializeCryptoBuffer initializes the crypto buffer
func InitializeCryptoBuffer() {
seed := uint32(0x00100001)
for index1 := 0; index1 < 0x100; index1++ {
index2 := index1
for i := 0; i < 5; i++ {
seed = (seed*125 + 3) % 0x2AAAAB
temp1 := (seed & 0xFFFF) << 0x10
seed = (seed*125 + 3) % 0x2AAAAB
temp2 := (seed & 0xFFFF)
CryptoBuffer[index2] = temp1 | temp2
index2 += 0x100
}
}
}