You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This currently breaks all comparisons of ohash sha256base64 vs. any externally generated sha256 base64 digest.
Additional context
This can be easily resolved by adding + and / to the line referenced in the link above, and then also adding the base64 padding char, = to the resulting string.
Thanks for reporting issue. I can take naming can be misleading indeed. We use base64 (instead of default hex) to fit more bytes in less string chars mainly and drop special chars to make hash more compatible.
We should improve docs.
I think if you need a version that allows two way conversion (between hex and base64) and compatible externally, we could add an option.
Sadly, I believe returning a non-compliant base64 string from a base64 function is a larger issue than simply documentation, but nonetheless, improved docs would certainly save some confusion 😄
Environment
Impacting all versions of ohash and node (since base64/sha256 were added)
Reproduction
https://jsfiddle.net/5wvt3qdx/
Describe the bug
Base64 character map is missing
+
,/
, and padding=
778413f#diff-6831e97cd83e9338eef1f644054e19e29bfc4c9898f875ce3671575ef099592cR71
This currently breaks all comparisons of ohash
sha256base64
vs. any externally generated sha256 base64 digest.Additional context
This can be easily resolved by adding
+
and/
to the line referenced in the link above, and then also adding the base64 padding char,=
to the resulting string.This change will also impact existing test cases.
Logs
No response
The text was updated successfully, but these errors were encountered: