Incorrect Padding
Closed this issue · 5 comments
Raikul commented
I´m sorry, but I keep getting the same Incorrect Padding error when I try to decode a deck with the new cards. It works perfectly for decks with old cards. Could it be because we´re only loading the json from set 1? There´s another json for set 2 available, called:
set2-en_us.json
I tried to make it work on my own but failed.
chuanpeng commented
Is this the error you are facing?
binascii.Error: Incorrect padding
I got them too when using these deck codes.
CIBQIAQGCQNCCMICAEBDOOIDAIBACAYJAMAQEBRQAMAQEAQMC4AQEAQGAIAQCARRAIBAMJRO
CIBAEAICAI4QUAQGAUFQ4FQ2EERSQMJ2AIAQCARBAEBAMHAA
CIBQIAQGDIQS2MIDAEBAENZZAQBAEAIDBEFAGAICAYJACAICAQAQEAQGAEAQEBRO
CIBAGAICBQLTSAYCAYNCCLQDAMAQEAQWG4AQEAQJAYBAMDQRCQTDCPIBAIAQEERR
CIBQIAQGCQNCCMICAEBDOOIDAIBACAYJAIBAEBROGABQCAQCBQLQGAICAYTACAICGEAQEAQG
CIBQEAQGCQQQEAICG44QIAQCAEBQMCIDAMBAMGRGGEBQCAQCAQYQCAQCBIBACAQGFYAQEAQF
CIBQEAQGBULASAICAYEQYEIVC4UDEOIBAIBAUAICAEBAEMIA
Did you manage to fix this yet?
Raikul commented
That is the same mistake indeed. It only happens to me when I import decks
that have cards from the Bilgewater expansion. My theory was that I needed
to include the set2 json. I tried some array wizardry but couldn´t get it
to work.
It may not be useful because I´m using your code for a telegram bot that
parses the decklists and that adds some noise, but this is what I get:
[image: imagen.png]
…On Thu, Jun 11, 2020 at 1:37 AM chuanpeng ***@***.***> wrote:
Is this the error you are facing?
binascii.Error: Incorrect padding
I got them too when using these deck codes.
CIBQIAQGCQNCCMICAEBDOOIDAIBACAYJAMAQEBRQAMAQEAQMC4AQEAQGAIAQCARRAIBAMJRO
CIBAEAICAI4QUAQGAUFQ4FQ2EERSQMJ2AIAQCARBAEBAMHAA
CIBQIAQGDIQS2MIDAEBAENZZAQBAEAIDBEFAGAICAYJACAICAQAQEAQGAEAQEBRO
CIBAGAICBQLTSAYCAYNCCLQDAMAQEAQWG4AQEAQJAYBAMDQRCQTDCPIBAIAQEERR
CIBQIAQGCQNCCMICAEBDOOIDAIBACAYJAIBAEBROGABQCAQCBQLQGAICAYTACAICGEAQEAQG
CIBQEAQGCQQQEAICG44QIAQCAEBQMCIDAMBAMGRGGEBQCAQCAQYQCAQCBIBACAQGFYAQEAQF
CIBQEAQGBULASAICAYEQYEIVC4UDEOIBAIBAUAICAEBAEMIA
Did you manage to fix this yet?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOXKGV6KCODJU4TTNLVD4DRWBNRTANCNFSM4NKXFTXA>
.
--
Tenchuu
chuanpeng commented
I made this change - you can try to see if it works for you.
diff --git a/twisted_fate/deck_coder/deckCoder.py b/twisted_fate/deck_coder/deckCoder.py
index 55615b3..f32a9b2 100644
--- a/twisted_fate/deck_coder/deckCoder.py
+++ b/twisted_fate/deck_coder/deckCoder.py
@@ -28,9 +28,9 @@ class Base32:
padding += result
length += result
"""
- padding = 8 - (length % 8)
-
- b32String += "=" * padding
+ if (length%8 > 0):
+ padding = 8 - (length % 8)
+ b32String += "=" * padding
return b32String
Raikul commented
It worked! Thanks a lot!
(Twisted Fate - Lee Sin best deck)
…On Thu, Jun 11, 2020 at 1:50 AM chuanpeng ***@***.***> wrote:
I made this change - you can try to see if it works for you.
diff --git a/twisted_fate/deck_coder/deckCoder.py b/twisted_fate/deck_coder/deckCoder.py
index 55615b3..f32a9b2 100644
--- a/twisted_fate/deck_coder/deckCoder.py
+++ b/twisted_fate/deck_coder/deckCoder.py
@@ -28,9 +28,9 @@ class Base32:
padding += result
length += result
"""
- padding = 8 - (length % 8)
-
- b32String += "=" * padding
+ if (length%8 > 0):
+ padding = 8 - (length % 8)
+ b32String += "=" * padding
return b32String
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOXKGV2UG24KHW65RLGGJDRWBPDHANCNFSM4NKXFTXA>
.
--
Tenchuu
Snowcola commented
@chuanpeng I have incorporated your fix into twisted_fate. In future you can submit a pull request should you have any fixes. Package is now up to date on PyPI as well.