diff options
author | Kyomotoi <[email protected]> | 2021-04-11 15:03:35 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-04-11 15:03:35 +0800 |
commit | cbf4900c5c3b1de65e55ce480d4b453091528e84 (patch) | |
tree | 6bde5ad2d8f6f4010cb317b2b72be36f17b503d4 /ATRI/plugins/utils/data_source.py | |
parent | 212424da74fecbd77c9824e422ea8b028b330c9e (diff) | |
download | ATRI-cbf4900c5c3b1de65e55ce480d4b453091528e84.tar.gz ATRI-cbf4900c5c3b1de65e55ce480d4b453091528e84.tar.bz2 ATRI-cbf4900c5c3b1de65e55ce480d4b453091528e84.zip |
🚀✨⚡️🎨🐛 正式推送
Diffstat (limited to 'ATRI/plugins/utils/data_source.py')
-rw-r--r-- | ATRI/plugins/utils/data_source.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ATRI/plugins/utils/data_source.py b/ATRI/plugins/utils/data_source.py index 71da581..18c0492 100644 --- a/ATRI/plugins/utils/data_source.py +++ b/ATRI/plugins/utils/data_source.py @@ -55,7 +55,7 @@ class Encrypt(): def _encodeByte(self, i) -> Union[str, None]: if i > 0xFF: - raise ValueError('ERROR! rc/nb overflow') + raise ValueError('ERROR! at/ri overflow') if i > 0x7F: i = i & 0x7F @@ -65,7 +65,7 @@ class Encrypt(): def _encodeShort(self, i) -> str: if i > 0xFFFF: - raise ValueError('ERROR! rcnb overflow') + raise ValueError('ERROR! atri overflow') reverse = False if i > 0x7FFF: @@ -93,11 +93,12 @@ class Encrypt(): if idx[0] < 0 or idx[1] < 0: idx = [self.cn.index(c[0]), self.cb.index(c[1])] nb = True - raise ValueError('ERROR! rc/nb overflow') + raise ValueError('ERROR! at/ri overflow') - result = idx[0] * self.sb + idx[1] if nb else idx[0] * self.sc + idx[1] + result = idx[0] * self.sb + idx[1] \ + if nb else idx[0] * self.sc + idx[1] if result > 0x7F: - raise ValueError('ERROR! rc/nb overflow') + raise ValueError('ERROR! at/ri overflow') return result | 0x80 if nb else 0 @@ -119,12 +120,12 @@ class Encrypt(): ] if idx[0] < 0 or idx[1] < 0 or idx[2] < 0 or idx[3] < 0: - raise ValueError('ERROR! not rcnb') + raise ValueError('ERROR! not atri') result = idx[0] * self.scnb + idx[1] * self.snb + idx[ 2] * self.sb + idx[3] if result > 0x7FFF: - raise ValueError('ERROR! rcnb overflow') + raise ValueError('ERROR! atri overflow') result |= 0x8000 if reverse else 0 return result @@ -155,8 +156,8 @@ class Encrypt(): result = [] for i in range(0, (len(s) >> 2)): result.append(bytes([self._decodeShort(s[i * 4:i * 4 + 4]) >> 8])) - result.append(bytes([self._decodeShort(s[i * 4:i * 4 + 4]) & 0xFF - ])) + result.append(bytes([ + self._decodeShort(s[i * 4:i * 4 + 4]) & 0xFF])) if (len(s) & 2) == 2: result.append(bytes([self._decodeByte(s[-2:])])) |