1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-07 10:47:19 -05:00
OpenDiablo2/MPQ/CryptoBuff.go

21 lines
519 B
Go
Raw Normal View History

2019-10-25 19:37:04 -04:00
package MPQ
2019-10-24 09:31:59 -04:00
// 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
}
}
}