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
I recently ported the idea of this library to Rust and discovered a few errors in your implementation.
The first is that the UUID and the generated phrase do not always form a bijection and therefore do not guarantee that the phrase is specific to that UUID. Consider the following example:
letuuid="67604e3d-5059-421e-a955-cc1ba9d4f66a";letres=ur.generate(uuid);letrev=ur..inverse(res);console.log(uuid);// 67604e3d-5059-421e-a955-cc1ba9d4f66aconsole.log(rev);// 67604e3d-5059-421e-a955-cc1ba9d4f62bconsole.log(uuid===rev);// This is false
The cause of this problem is that in your lists (data) you have duplicate entries, which defeats the purpose of not losing entropy. Let's take the example of README:
For example, 7 bits for animal means we choose one animal from a list of atleast 2**7 = 128 animals
This is wrong because the maximum value that can be obtained with 7 bits is 127 + 1 (because of the index 0), if we remove the number of duplicates in the first 128 animals of the noun.json, we end up with less than 128 (I have not checked how many, but horses and frogs are duplicated so already 126).
The second is that you have entries in your lists (data) with spaces in them. This is a problem for the inverse method.
In deSentence, you separate words using spaces (' ') but with spaces in the words in your lists, this makes the reverse search invalid.
Take for example:
letuuid="67604e3d-5059-421e-a955-cc1ba9d4f66c";letres=idk.generate(uuid);console.log(res);// Enid Adolph Beller the Builder of Anniston encourages Kettie Dru Karon and 9 thirsty gila monstersletrev=idk.inverse(res);// This panic with "Not A Valid UUID Readable"
My suggestion to solve these problems is to correct the lists by deleting duplicate entries, deleting spaces in the entries and releasing a new version that will not be compatible with the previously generated UUID in some cases (due to change of index of entries, ...).
The text was updated successfully, but these errors were encountered:
Hey !
I recently ported the idea of this library to Rust and discovered a few errors in your implementation.
The first is that the UUID and the generated phrase do not always form a bijection and therefore do not guarantee that the phrase is specific to that UUID. Consider the following example:
The cause of this problem is that in your lists (data) you have duplicate entries, which defeats the purpose of not losing entropy. Let's take the example of README:
This is wrong because the maximum value that can be obtained with 7 bits is 127 + 1 (because of the index 0), if we remove the number of duplicates in the first 128 animals of the noun.json, we end up with less than 128 (I have not checked how many, but
horsesandfrogsare duplicated so already 126).The second is that you have entries in your lists (data) with spaces in them. This is a problem for the
inversemethod.In
deSentence, you separate words using spaces (' ') but with spaces in the words in your lists, this makes the reverse search invalid.Take for example:
My suggestion to solve these problems is to correct the lists by deleting duplicate entries, deleting spaces in the entries and releasing a new version that will not be compatible with the previously generated UUID in some cases (due to change of index of entries, ...).
The text was updated successfully, but these errors were encountered: