kstenerud / concise-encoding

The secure data format for a modern world
https://concise-encoding.org
Other
258 stars 4 forks source link

Year limit #31

Open kengruven opened 3 years ago

kengruven commented 3 years ago

After a certain point, enctool kind of gives up trying to handle years, and just latches on to a particular value:

$ echo 'c1 1000000000000000000000000000000-1-1'|./enctool convert -df cbe|hexdump -C
00000000  03 00 99 21 3e 9f c0 e1  0e                       |...!>....|
00000009
$ echo 'c1 100000000000000000000000000000000-1-1'|./enctool convert -df cbe|hexdump -C
00000000  03 00 99 21 3e 9f c0 e1  0e                       |...!>....|
00000009
$ echo 'c1 10000000000000000000000000000000000-1-1'|./enctool convert -df cbe|hexdump -C
00000000  03 00 99 21 3e 9f c0 e1  0e                       |...!>....|
00000009

The value doesn't seem to have any useful meaning, or at least, not that enctool can recognize:

$ echo 'c1 1000000000000000000000000000000-1-1'|./enctool convert -df cbe|./enctool convert -df cte
c0
-1981284352-01-0

In particular, though, enctool doesn't seem to have any limit on year size -- not even the normal integer limit.

(Implementation note: I have a separate max digit limit for years, and my default is 4. I used to write archaeology software that dealt with samples thousands of years old, so I've run into every year-related bug in the book. There simply aren't any use cases for that level of precision, that far out. Nobody has ever needed to record that something happened on July 17 in the Pleistocene.)