powturbo / Turbo-Base64

Turbo Base64 - Fastest Base64 SIMD:SSE/AVX2/AVX512/Neon/Altivec - Faster than memcpy!
GNU General Public License v3.0
277 stars 41 forks source link

cannot decode base64 with length 785 #9

Closed lennonlam closed 2 years ago

lennonlam commented 3 years ago

Hello, tb64declen() and tb64dec() return 0 when the input base64 has length of 785 it's repeatable with the following b64

UVNUSwEGBgACQAAF//4A//0C+fb//QcF/fgJAP8GCvgEB/0JAP77/fwJBQH2APz/AAIA/vUDAAID+wIC/vwA/gIH/fr//f0CBwH8/QMBAwgAAvf9AgAMEf0A/wX3BgAC+QD/Bv0LBQEB/QT9Bg3+A/7+Bf70/PwB+PsI9vkJAwv+AP4EAwD4//r8/fUBA/wD+P8FAAQCBQEBAP/9BgMH//4F//wAAPn4/AAH/P8JAgAAAfsGAAEJ/wAC/v75BwIHA/sF+v4ABfr8AP79A/37BQgBAAD6AAYCBAcD/QL3CP72/wAAAQAABP7+AP4AAvgB/PkAAQD+DgUABAAFBfAA///7/QoEBAEEAv8DC/8BAPoB+v7/AP//AAr+AO0S+/oFAgYF/wb7BQP99QcCAQT5CPkAAAj9AAT/8/n1AQMD9/UL/wAAAgL//fgIBv/8Aw4A+/4GCPYAAQED9AkDAvkG/gP8AggC/fr/Bwb+AgD/9f3/BgIF+BH9BP3+AgMEBAkGA/4AAwv6AQUDAPz+BwQC+/L2+f75/wX/APj/AwkAAQX+AAD6//oDAgwAAAH9+AP/AP4A/QIA/An2+/n9AAAFAAMCBAYD+wH+/QD7BP//9gABA/T3CAAJAP0A/PgB/wICAAX7BAL6BQIE//z+/wcB9/z6AvUEAAIE/wEECf748P0DAv0E/AEFAAD7+Qz/9wDeCQvq+gT09/P8/AAdERf+8df57AsC+wzv+fzY+Qrt8hgbAecG7B31AgL1+Pj6+OUP8wX5Bub9+AD6CgE=

is there any limitation on the input?

Thanks

powturbo commented 2 years ago

There is not limit for the input. The string to decode must be padded with "=" to the multiple of 4. There is a additional "=" in your string, the length should be 784.