01FZD39998855SS2YG4XP4T14P does not round trip between base32-decode and base32-encode
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
`01FZD39998855SS2YG4XP4T14P` is a valid base32 encoded string and a base32 string should round trip between `b32decode` and `b32encode` to the same value. It doesn't. The `crockford-base32` package does the round trip correctly.
```js
import b32decode from 'base32-decode';
import b32encode from 'base32-encode';
import { CrockfordBase32 } from 'crockford-base32';
const uid = '01FZD39998855SS2YG4XP4T14P';
const buffer = CrockfordBase32.decode(uid);
console.log('decoded', new Uint8Array(buffer).toString());
const res = CrockfordBase32.encode(buffer);
console.log('encoded', res);
const decoded = b32decode(uid, 'Crockford');
console.log('DECODED', new Uint8Array(decoded).toString());
const encoded = b32encode(decoded, 'Crockford');
console.log('ENCODED', encoded);
```
Result:
```
decoded 1,127,218,52,165,40,65,75,156,139,208,39,108,77,4,150
encoded 01FZD39998855SS2YG4XP4T14P
DECODED 0,95,246,141,41,74,16,82,231,34,244,9,219,19,65,37
ENCODED 01FZD39998855SS2YG4XP4T14M
```
Run it on stackblitz:
https://stackblitz.com/edit/js-esmrfr
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the mismatch using the `base32-decode` and `base32-encode` imports with the provided UID, then inspect their Crockford variant handling. Compare the decoded bytes and encoded result with `crockford-base32`; done means the value round trips back to `01FZD39998855SS2YG4XP4T14P`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100