Skip to content

Conversation

@david-build
Copy link

  1. Added = sign for base64 url encoding
  2. Shorter crc16 with same result.

1. Added = sign for base64 url encoding
2. Shorter crc16 with same result.
@ingria
Copy link
Contributor

ingria commented Apr 11, 2023

Thanks for the PR.

I’ll look into your crc16 implementation, but I cannot understand what’s your idea behind the padding sign replacement (= to -).

Could you please elaborate?

@david-build
Copy link
Author

Hi, dear! About sign equals:

While I wrote the packing and checking CRC16 function for converting RAW to Human Friendly TON address, I did tests on thousands of addresses. And I met somewhere that after base64encode the address got "=" at the end. Therefore, I decided to replace = in my code as well.

I think, just in case, it is better to have it than not. Since it has no effect for the worse.

@ingria
Copy link
Contributor

ingria commented Apr 12, 2023

Unfortunately it doesn't work this way. The RFC standard for base64url defines = as optional, and - as 62nd alphabet symbol.

If we replace = with -, it would be impossible to decode an encoded string, because parser wouldn't know for sure where is the padding symbol and where is the 62th symbol.

Also TON addresses are specifically designed not to have = at the end, so if you see = in the address, it means that the address is invalid.

@david-build
Copy link
Author

Good, thanks! I'm change it too in our side.
Create one other pull request only with crc32?

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

Successfully merging this pull request may close these issues.

2 participants