Closed oculus42 closed 7 years ago
Discovered while poking around Apple's HomeKit documentation, which uses capital letters in their UUIDs. Translation to flickrBase58 and back resulted in a different value:
Example:
const Short = require('short-uuid'); const hue = '00000013-0000-1000-8000-0026BB765291'; const hue_low = hue.toLowerCase(); const translator = Short(); let hUpper = translator.fromUUID(hue); // 2zMGpBQgCiDegNB6pP let hLower = translator.fromUUID(hue_low); // 2zMGpBQgCiDen23yUa console.log(hUpper, hLower, hUpper === hLower); // false; let uUpper = translator.toUUID(hUpper); // 00000013-0000-1000-8000-0025ef765291 let uLower = translator.toUUID(hLower); // 00000013-0000-1000-8000-0026bb765291 console.log(uUpper, uUpper === hue || uUpper === hue_low); // false console.log(uLower, uLower === hue || uLower === hue_low); // true
The fix is relatively simple: use .toLowerCase() before running through any-base.
.toLowerCase()
A fix with unit tests is forthcoming.
Discovered while poking around Apple's HomeKit documentation, which uses capital letters in their UUIDs. Translation to flickrBase58 and back resulted in a different value:
Example:
The fix is relatively simple: use
.toLowerCase()
before running through any-base.A fix with unit tests is forthcoming.