refactor: rename xm -> xiami

This commit is contained in:
Unlock Music Dev
2022-11-20 02:18:50 +08:00
parent 14c9d49d46
commit 8e068b9c8d
3 changed files with 3 additions and 3 deletions

21
algo/xiami/xm_cipher.go Normal file
View File

@@ -0,0 +1,21 @@
package xiami
type xmCipher struct {
mask byte
encryptStartAt int
}
func newXmCipher(mask byte, encryptStartAt int) *xmCipher {
return &xmCipher{
mask: mask,
encryptStartAt: encryptStartAt,
}
}
func (c *xmCipher) Decrypt(buf []byte, offset int) {
for i := 0; i < len(buf); i++ {
if offset+i >= c.encryptStartAt {
buf[i] ^= c.mask
}
}
}