quackduck / aces

Encode in a character set of your choice
MIT License
68 stars 3 forks source link

Pretty warning when one or more characters are duplicates in the charset #3

Closed xplshn closed 4 months ago

xplshn commented 4 months ago

This PR fixes https://github.com/quackduck/aces/issues/2

quackduck commented 4 months ago

Should this be just a warning or a full error? I'm on the side of making this a fatal error.

xplshn commented 4 months ago

But what if someone wants to use aces in a script where the charset may be determined by the user or data that could contain repetitions?

Anyways, its up to you to decide this. The first commit makes it a fatal error, the second I thought about the case I just mentioned and decided to make it a warning

quackduck commented 4 months ago

But what if someone wants to use aces in a script where the charset may be determined by the user or data that could contain repetitions?

Repeats in a charset make it impossible to decode data. Think of what would happen if two digits looked the exact same: you'd never be sure what number you actually have. Here's another example, what if I encoded with the charset 00? Any data I put in would just get replaced with zeros, and you'd have no hope of reconstructing what I put in.

xplshn commented 4 months ago

Its up to you to decide what to do, the warning could be made into an error and use a simple global bool to have it be a warning in lax situations