Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing bytes decoding url64 #11

Open
singpolyma opened this issue Sep 19, 2023 · 2 comments
Open

Missing bytes decoding url64 #11

singpolyma opened this issue Sep 19, 2023 · 2 comments

Comments

@singpolyma
Copy link

basexx.from_url64("BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bjyPjs7Vd8pZGH6SRpkNtoIAiw4")

this misses the last 3 bytes

@aiq

This comment was marked as outdated.

@aiq
Copy link
Owner

aiq commented Sep 28, 2023

Hi,

what values do you expect?

I tested your input string with https://cryptii.com/pipes/base64-to-hex Base64(RFC 4648 §5) and get the following output:

04 25 71 b2 be cd fd e3 60 55 1a af 1e d0 f4 cd 36 6c 11 ce be 55 5f 89 bc b7 b1 86 a5 33 39 17 31 68 ec e2 eb e0 18 59 7b d3 04 79 b8 6e 3c 8f 8e ce d5 77 ca 59 18 7e 92 46 99 0d b6 82 00 8b 0e

Thats the same value that I get in my added test:

it( "should work with the binary example", function()

   local bin64 = "BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bjyPjs7Vd8pZGH6SRpkNtoIAiw4"
   local bin = string.char( 0x04, 0x25, 0x71, 0xb2, 0xbe, 0xcd, 0xfd, 0xe3, 0x60, 0x55, 0x1a, 0xaf,
                            0x1e, 0xd0, 0xf4, 0xcd, 0x36, 0x6c, 0x11, 0xce, 0xbe, 0x55, 0x5f, 0x89,
                            0xbc, 0xb7, 0xb1, 0x86, 0xa5, 0x33, 0x39, 0x17, 0x31, 0x68, 0xec, 0xe2,
                            0xeb, 0xe0, 0x18, 0x59, 0x7b, 0xd3, 0x04, 0x79, 0xb8, 0x6e, 0x3c, 0x8f,
                            0x8e, 0xce, 0xd5, 0x77, 0xca, 0x59, 0x18, 0x7e, 0x92, 0x46, 0x99, 0x0d,
                            0xb6, 0x82, 0x00, 0x8b, 0x0e )

   assert.is.same( bin64, basexx.to_url64( bin ) )
   assert.is.same( bin, basexx.from_url64( bin64 ) )
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants